I have an implicit function, for example:
f(x,y) = x**y + y**y - 3*x
I want to solve the root on a meshgrid. So f(x,y) = 0
Drawing the solution is easy:
x = linspace(-2,2,11)
y = linspace(-2,2,11)
(X,Y) = meshgrid(x,y)
A = X**Y + Y**Y - 3*X
contour(X,Y,A,0)
This works great, I have a drawing of the curve I need, however I would like to have the data that is in the plot and not only the visual plot. So how do I find the data of the plot?
You can get “the data that is in the [matplotlib] plot” using:
There are a variety of algorithms for calculating the contours directly, though I don’t know of any numpy/scipy versions. Marching squares is the one I always here about, although the algorithm is patented and there are severe restrictions on it’s use, so I doubt matplotlib uses it. Here’s a link with a bit of chat on how matplotlib calculates the contours.