Matplotlib中具有独立缩放比例的多个重叠图 [英] Multiple overlapping plots with independent scaling in Matplotlib

查看:31
本文介绍了Matplotlib中具有独立缩放比例的多个重叠图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有代码多次调用 matplotlib.pylab.plot 以在同一屏幕上显示多组数据,并且考虑到所有绘图,Matplotlib 将每个数据缩放到全局最小值和最大值.有没有办法要求它独立缩放每个图,使其达到该特定图的最小值和最大值?

I currently have code that calls matplotlib.pylab.plot multiple times to display multiple sets of data on the same screen, and Matplotlib scales each to the global min and max, considering all plots. Is there a way to ask it to scale each plot independently, to the min and max of that particular plot?

推荐答案

对此没有直接支持,但这里有一些来自 邮件列表发布,说明了两个独立的垂直轴:

There's no direct support for this, but here's some code from a mailing list posting that illlustrates two independent vertical axes:

x=arange(10)
y1=sin(x)
y2=10*cos(x)

rect=[0.1,0.1,0.8,0.8]
a1=axes(rect)
a1.yaxis.tick_left()
plot(x,y1)
ylabel('axis 1')
xlabel('x')

a2=axes(rect,frameon=False)
a2.yaxis.tick_right()
plot(x,y2)
a2.yaxis.set_label_position('right')
ylabel('axis 2')
a2.set_xticks([])

这篇关于Matplotlib中具有独立缩放比例的多个重叠图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆