是否有办法使摇摄功能同时调整主机和寄生y轴,而不使寄生轴固定?
示例:
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt
host = host_subplot(111, axes_class=AA.Axes)
par1 = host.twinx()
new_fixed_axis = par1.get_grid_helper().new_fixed_axis
host.set_xlim(0, 2)
host.set_ylim(0, 2)
host.set_xlabel("Distance")
host.set_ylabel("Density")
par1.set_ylabel("Volume")
par1.axis['right'].toggle(all = True)
host.plot([0, 1, 2], [0, 1, 2])
par1.plot([0, 1, 2], [2, 4, 3])
plt.show()发布于 2017-10-30 21:18:10
我采纳了@ImportanceOfBeignErnest的建议,重新设计了一些不使用mpl_toolkits的情节。相反,我使用样条来添加附加轴。这种类型的图的一个例子可以找到这里。
https://stackoverflow.com/questions/46978449
复制相似问题