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?
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With