동일한 페이지에 7 시리즈를 플롯하기위한 스크립트가 있습니다. 페이지 방향을 세로로 설정하고 싶습니다. 당신이 볼 수 있듯이, 나는 시도했다 :Matplotlib | 방향을 세로로 변경하십시오.
f.savefig(sta+'.pdf', orientation='portrait', format='pdf')
그러나 아무 일도 일어나지 않는다!
의견이 있으십니까? 사전에
f, (ax1, ax2, ax3, ax4, ax5, ax6, ax7) = plt.subplots(7, sharex=True, sharey=False)
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=0.5)
ax1.plot(xtr[:num.size(xt),i], color='black')
ax2.plot(ytr[:num.size(yt),i], color='black')
ax3.plot(ztr[:num.size(zt),i], color='black')
ax4.plot(obs_dataV[:,i], color='g')
ax5.plot(obs_dataH[:,i], color='r')
ax6.plot(obs_dataP, color='g')
ax7.plot(obs_dataS, color='r')
ax1.set_title(sta+' Raw data', loc='left', fontsize='10')
ax4.set_title('Vertical and Horizontal traces', loc='left', fontsize='10')
ax6.set_title('Characteristic functions', loc='left', fontsize='10')
ax1.legend('X',loc='center right', fontsize='12')
ax2.legend('Y',loc='upper right', fontsize='12')
ax3.legend('Z',loc='upper right', fontsize='12')
ax4.legend('P',loc='upper right', fontsize='12')
ax5.legend('S',loc='upper right', fontsize='12')
ax6.legend('P',loc='upper right', fontsize='12')
ax7.legend('S',loc='upper right', fontsize='12')
f.savefig(sta+'.pdf', orientation='portrait', format='pdf')
plt.show()
덕분에
'orientation = 'portrait''이 (가) h가 아닙니다. 이 경우에는 많은 의미가 있습니다. pdf에있는 페이지의 크기는 그림의 크기로 정의됩니다. (포스트 스크립트 백엔드의 경우 실제로는 약간 다릅니다. kwarg가 의미하는 바입니다.) 그림의 크기를 변경하고 싶습니까? –
그림에서 세로로 플롯을 쌓으려고합니까? 또는 가로로 7 개의 좁은 플롯이되도록 플롯의 가로 세로 비율을 설정 하시겠습니까? – mauve
감사합니다. Joe! 나는 모든 백엔드에서 kwargs가 지원되지 않는다는 것을 몰랐습니다. PS 형식으로 변경했으며 plt.subplots()에서 숫자 크기를 변경했습니다. – CatarinaCM