pylab 中的顶部和底部轴(例如带有不同的单位)(或左轴和右轴)
我正在尝试使用 pylab/matplotlib 绘制绘图,并且我有两组不同的 x 轴单位。 所以我希望该图有两个具有不同刻度的轴,一个在顶部,一个在底部。 (例如,一个带有英里,一个带有公里左右。)
如下图所示(但我想要多个 X 轴,但这并不重要。)
有人知道 pylab 是否可以实现这一点吗?
I'm trying to make a plot with pylab/matplotlib, and I have two different sets of units for the x axis. So what I would like the plot to have is two axis with different ticks, one on the top and one on the bottom. (E.g. one with miles and one with km or so.)
Something like the graph below (but than I would like multiple X axes, but that doesn't really matter.)
Anyone an idea whether this is possible with pylab?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能有点晚了,但看看这样的东西是否有帮助:
http://matplotlib。 sourceforge.net/examples/axes_grid/simple_axisline4.html
This might be a little late but see if something like this would help:
http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline4.html
在“原始”框架旁边添加多个轴(如示例图片所示)可以通过使用
twinx
添加附加轴并配置其spines
属性来实现。我认为这看起来与示例图片非常相似:
Adding multiple axes next to the "original" frame, as seen in the example picture, can be achieved by adding additional axes with
twinx
and configuring theirspines
attribute.I think this looks quite similar to the example picture: