http://onlyamodel.com/2009/dual-units-in-scientific-plots/
如何设置双y轴(相同数据但具有不同单位的2 y轴)。 然后我想用
为我的情节设置纵横比plt.gca().set_aspect('equal', adjustable='box')
但它不起作用。我明白了:
ValueError: adjustable must be "datalim" for shared axes
任何人都可以帮我吗? THX
fig = plt.figure(figsize=(10,11))
ax = fig.add_subplot(111)
xmin = -60
xmax = 60
ymin = 0.0
ymax = 220.0
axis([xmin, xmax, ymin, ymax])
ax.yaxis.tick_left()
ax.grid(True,linestyle='-',color='0.75')
ax.set_axisbelow(True)
cax = ax.scatter(x, z, s=intenzita, c=strain, marker = 'o', linewidth = '0.5', cmap = cm.jet, vmin = -0.005, vmax = -0.000)# strain13 a ine
cbar = plt.colorbar(cax)
cbar.ax.tick_params(labelsize=20)
ax.set_xlim(-60, 60)
ax.set_ylim(0, 220)
ymin2 = yconv(ymin)
ymax2 = yconv(ymax)
print ymax2
ax2 = twinx()
ylabel('Depth (cm)', fontsize=20)
axis([xmin, xmax, ymin2, ymax2])
ax2.yaxis.tick_right()
plt.gca().set_aspect('equal', adjustable='box')
ax.tick_params(labelsize = 20)
ax.set_xlabel('x grain position [%sm]'%mi, fontsize=25)
ax.set_ylabel('z grain position [%sm]'%mi, fontsize=30)
cbar.set_label('%s_11'%epsilon, color = 'k', fontsize = 30) #strain
plt.show()
x,z,intenzita,strain都是列表