Skip to content

Extracting the indices of the contour #66

Open
@oashour

Description

Let's take the sample code from the documentation

for cl in levels(contours(x,y,z))
    lvl = level(cl) # the z-value of this contour level
    for line in lines(cl)
        xs, ys = coordinates(line) # coordinates of this line segment
    end
end

I need the indices of xs and ys in x and y, i.e.in a simple world this would be:

ix = indexin(xs, x)
iy = indexin(ys, y)
this_contour = z[ix, iy]

However, xs and ys do not belong exactly to x and y, and I can't figure out how to extract the indices. The reason I need to do this is that I have an auxiliary array w that has the same shape as z, and I would like to extract the part corresponding to the contours.

Is there some way to do this? Does contour.jl return the indices somehow?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions