동일한 x 축을 가진 여러 개의 플롯이 있습니다. 나는 그들을 보고서에 쌓아 놓고 모든 것이 정렬되게하고 싶다. 그러나 matplotlib는 y tick 레이블 길이에 따라 약간 크기가 조정 된 것으로 보입니다.플롯 영역을 고정하기 위해 matplotlib를 강제로 만듭니다.
내가 저장 한 PDF 캔버스에 비례하여 플롯 영역과 위치가 플롯간에 동일하게 유지되도록 할 수 있습니까?
import numpy as np
import matplotlib.pyplot as plt
xs=np.arange(0.,2.,0.00001)
ys1=np.sin(xs*10.) #makes the long yticklabels
ys2=10.*np.sin(xs*10.)+10. #makes the short yticklabels
fig=plt.figure() #this plot ends up shifted right on the canvas
plt.plot(xs,ys1,linewidth=2.0)
plt.xlabel('x')
plt.ylabel('y')
fig=plt.figure() #this plot ends up further left on the canvas
plt.plot(xs,ys2,linewidth=2.0)
plt.xlabel('x')
plt.ylabel('y')
같은 그림에서 서브 플로트로 그릴 수 있습니까? – DavidG
두 경우 모두 플롯의 크기가 동일합니다. 또한 축의 크기도 같습니다. 당신이 요구하는 것이 명확하지 않습니다. – ImportanceOfBeingErnest