0

I have plotted a contour line of a specific level for three different parameters namely |G|, 1-Cn/C and VgN/c and want to save the x and y coordinates of the contour line that is common to all three contour lines. I want to store the x and y coordinates in a .txt file. I can store the points for specific contour lines of a single contour plot but am not able to get the point that is common to all the three contour lines of different plots. Used this to get the x and y coordinates of a contour line https://stackoverflow.com/a/25208345/16319933

khmax = np.arange(0,np.pi,0.01)
Ncmax = np.arange(0,np.pi,0.01)
[X, Y] = np.meshgrid(Ncmax,khmax)
fig, ax = plt.subplots()

mod_G = (((G_real)**2) + ((G_imag)**2))**(0.5)

line_colours = ['blue']
contour = plt.contour(X,Y,mod_G,levels = [1.000000000],colors = line_colours)

ax.set_title('magnitude of G')
ax.set_xlabel('Ncmax')
ax.set_ylabel('khmax')
ax.clabel(contour, inline= True,inline_spacing = -1,fmt = '%.9f',fontsize=9)
plt.xlim(0, np.pi)
plt.ylim(0, np.pi)
plt.show()

beta = np.arctan(-((G_imag) / (G_real)))
phase_speed = 1-(beta /(X * Y))

ax.set_title('magnitude of 1-Cnum / C')
ax.set_xlabel('Ncmax')
ax.set_ylabel('khmax')
contour = plt.contour(X,Y,phase_speed,levels = [0.0],colors = 'black')
ax.clabel(contour, inline= True,inline_spacing = -2,  fontsize=8)
plt.show()

contour = plt.contour(X,Y,VgN,levels = [1.0])
ax.set_title('magnitude of VgN/c')
ax.set_xlabel('Ncmax')
ax.set_ylabel('khmax')
ax.clabel(contour, inline= True, inline_spacing = -1,fmt = '%1.8f',fontsize=8)
plt.show()

For example, I have these graphs: |G| 1-Cn/C VgN/c I need to get the x and y coordinates of common points in all three graphs and store them. It is not the whole code. It is just the part where plotting is done. Any kind of help is highly appreciated.

Avii
  • 164
  • 11

0 Answers0