0

How can I get the (x,y) coordinates of a particular contour plotted by matplotlib function contour ? for example:

import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(20,40,100)
y = np.linspace(0,100,100)
z = x**2 + y**2
plt.figure()
plt.contour(x,y,z)

Now I want the (x,y) coordinates for a particular z as plotted in the plot? How do I get that?

I tried plotting and the plot shows expected results, but I don't know of a way to extract values form such a plot.

SG_00
  • 1
  • Can you be a bit more specific about why you want the coordinates and for which particular `z`? Because you have all the `x`, `y`, and `z` values defined prior to plotting ;) – m13op22 Jul 25 '23 at 14:14
  • I will do another calculation where I want my z value to be fixed and then move along the (x,y) coordinates. – SG_00 Jul 25 '23 at 14:20

0 Answers0