在matplotlib中,如何在图形的两边显示一个轴? [英] In matplotlib, how do you display an axis on both sides of the figure?
本文介绍了在matplotlib中,如何在图形的两边显示一个轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用matplotlib画一个图,图的两边都有轴,类似于这个图(颜色与本题无关):
I want to draw a plot with matplotlib with axis on both sides of the plot, similar to this plot (the color is irrelevant to this question):
我怎样才能用 matplotlib
做到这一点?
How can I do this with matplotlib
?
注意:与示例图中显示的相反,我希望两个轴完全相同,并且只想显示一个图.添加两个轴只是为了让图表更容易阅读.
Note: contrary to what is shown in the example graph, I want the two axis to be exactly the same, and want to show only one graph. Adding the two axis is only to make reading the graph easier.
推荐答案
在线文档中有几个相关示例:
There are a couple of relevant examples in the online documentation:
- Two Scales (seems to do exactly what you're asking for)
- Dual Fahrenheit and Celsius
这篇关于在matplotlib中,如何在图形的两边显示一个轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文