1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| import matplotlib.pyplot as plt import numpy as np fn="EV.dat" f=np.loadtxt(fn)
fig = plt.figure()
ax=fig.add_subplot(121, projection='polar')# ,facecolor="lightgoldenrodyellow") skip=2 theta= f[0::skip,0] Y=f[0::skip,1] ax.plot(theta, Y, color="tab:orange", lw=1, ls="--", marker='h',alpha=0.6, label="$E$") ax.set_rlabel_position(10) # get radial labels away from plotted line ax.tick_params(grid_color="palegoldenrod") angle = np.deg2rad(67.5) ax.legend(loc="lower left", bbox_to_anchor=(.5 + np.cos(angle)/2, .5 + np.sin(angle)/2))
ax1=fig.add_subplot(122, projection='polar') #,facecolor="lightgoldenrodyellow") ax1.tick_params(grid_color="palegoldenrod") V=f[:,2] T=f[:,0] Vp_idx=np.where(V>0) Vn_idx=np.where(V<0)
skip1=3 Vp=V[Vp_idx][0::skip1] theta_p=T[Vp_idx][0::skip1]
skip2=1 Vn=V[Vn_idx][0::skip2] theta_n=T[Vn_idx][0::skip2]
ax1.plot(theta_p, Vp, color="tab:green", lw=1, ls="--", marker='h',alpha=0.6, label=r"+ $\nu$") ax1.plot(theta_n, Vn, color="tab:red", lw=0.1, marker='o',alpha=.5, label=r"- $\nu$") angle = np.deg2rad(67.5) ax1.legend(loc="lower left", bbox_to_anchor=(.5 + np.cos(angle)/2, .5 + np.sin(angle)/2)) #ax1.set_rmax(2) ax1.set_rlabel_position(45) # get radial labels away from plotted line ax1.set_rticks([0.3, 0.60, 0.9]) # less radial ticks
plt.tight_layout() #plt.savefig('EV.jpg',format='jpg',dpi=300) plt.show()
|