두 개의 그래프를 한 화면에 그려야합니다. x 축은 동일하게 유지되지만 y 축은 달라야합니다.matplotlib에서 x 축을 공유하는 두 개의 그래프 플로팅
'matplotlib'에서 어떻게 할 수 있습니까?
두 개의 그래프를 한 화면에 그려야합니다. x 축은 동일하게 유지되지만 y 축은 달라야합니다.matplotlib에서 x 축을 공유하는 두 개의 그래프 플로팅
'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()
twinx
당신이 찾고있는 기능입니다; 그것을 사용하는 방법의 here's an example.
twinx example http://matplotlib.sourceforge.net/_images/two_scales.png