0
이 주제에 대한 많은 질문을 발견했지만 파이썬에서 날짜 정보를 표시하는 기본 단계를 이해할 수 없습니다.matplotlib의 날짜를 NaN 값으로 플로팅
내 시계열 내 데이터가
>>> data.shape
(8736,)
#contains np.nan values!!!
입니다
>>> datetime_series.shape
(8736,)
>>> datetime_series
array([datetime.datetime(1979, 1, 2, 0, 0),
datetime.datetime(1979, 1, 2, 1, 0),
datetime.datetime(1979, 1, 2, 2, 0), ...,
datetime.datetime(1979, 12, 31, 21, 0),
datetime.datetime(1979, 12, 31, 22, 0),
datetime.datetime(1979, 12, 31, 23, 0)], dtype=object)
입니다
내 코드를 지금 (내 내가 ... 시도 무엇입니까 주석)
fig,ax1 = plt.subplots()
plt.plot(datetime_series,data)
#plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%d-%m'))
#plt.gca().xaxis.set_major_locator(mdates.DayLocator())
#plt.gcf().autofmt_xdate()
#ax1.set_xlim([datetime_series[0],datetime_series[-1])
ax1.set_ylabel('Cumulative windspeed over open water [m/s]')
#ax1.set_xlim(### how do I do this??
plt.title('My title')
fig.tight_layout()
plt.show()
이것은 생산 빈 음모.
누구든지 datetime을 계획하는 단계를 안내 할 수 있다면 설명서와 stackoverflow 답변에 모두 다른 방법이있는 것 같아서 어디서부터 시작해야할지 이해할 수 없습니다. (예 : plot_date와 데이터가 그래프로 표시되지 않는 이유 plt.plot()
날짜를 사용하는 방법에 대한 [공식 예 (https://matplotlib.org/2.0.1/examples/api/date_demo.html)가있다. – ImportanceOfBeingErnest