1つの画面に2つのグラフをプロットする必要があります。x軸は同じままですが、y軸は異なる必要があります。
'matplotlib'でそれを行うにはどうすればよいですか?
1つの画面に2つのグラフをプロットする必要があります。x軸は同じままですが、y軸は異なる必要があります。
'matplotlib'でそれを行うにはどうすればよいですか?
subplot
同じキャンバスに複数の図をプロットできます。リンクされたドキュメント ページの例を参照してください。
共有軸プロットの例がサンプル ディレクトリにあり、次のように呼ばれshared_axis_demo.py
ます。
from pylab import *
t = arange(0.01, 5.0, 0.01)
s1 = sin(2*pi*t)
s2 = exp(-t)
s3 = sin(4*pi*t)
ax1 = subplot(311)
plot(t,s1)
setp( ax1.get_xticklabels(), fontsize=6)
## share x only
ax2 = subplot(312, sharex=ax1)
plot(t, s2)
# make these tick labels invisible
setp( ax2.get_xticklabels(), visible=False)
# share x and y
ax3 = subplot(313, sharex=ax1, sharey=ax1)
plot(t, s3)
xlim(0.01,5.0)
show()