6

I had to use contour plots to generate plots of a set of inconveniently defined hyperbolic functions. This works and it plots a series of them with some noise added (it's a passive RF geolocation TDOA problem for those who are familiar with such things).

Since my python program knows the (x,y) of the target, I want to sample all the different hyperbolas that I'm drawing around that point and generate an error ellipse. If I can get the Matplotlib contour function to return the points of each contour line as it is drawn, I can handle the rest of the calculations. So...

Can the Matplotlib contour function return all of the (x,y) values for a particular contour line, say at f(x,y)=0?

1 Answer 1

7

You can draw a contour at a specific level like this:

c = plt.contour(X, Y, Z, [level])

Now you can extract the contour points from the returned object c (see this answer):

v = c.collections[0].get_paths()[0].vertices
x = v[:,0]
y = v[:,1]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.