내 그림의 상단 근처에 범례를 표시하려고에 제목과 범례를 사용자 정의 (this을 같은)과 그 위의 제목 (this 같은) 그러나파이썬은 그림
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1,24,1)
y = np.array([400,650,1020,1300,1600,1950,2200,2550,2850,3150,3400,3550,3800,3950,4050,4150,4210,4250,4300,4320,4310,4300,4200])
fig = plt.figure()
ax = plt.subplot(111)
ax.plot(x,y,'o', label='data set 1')
plt.text(0.5, 1.4, 'Data set A-1',
horizontalalignment='center',
fontsize=16,
transform = ax.transAxes)
ax.set_xlabel('x', fontsize=14)
ax.set_ylabel('y', fontsize=14)
ax.set_ylim(ymax=5000)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.25),
ncol=3, fancybox=True, shadow=True)
#plt.tight_layout()
plt.show()
fig.savefig('test.pdf')
,이 그래프를 저장할 때 제목과 범례가 모두 누락되었습니다. 축과 데이터 포인트 만 pdf에 저장됩니다.
당신이 사용하는 파이썬의 버전? –
Python 2.7.7, Spyder 2.3.0 (하지만 Spyder와 아무런 관련이 없음) –
이들은 그림의 관점에서 볼 때 너무 멀리 위에 있습니다. 숫자가 작아 지도록 크기를 조정하면 나타나기 시작합니다. – Ajean