subplot 함수와 두 개의 다른 x 축 (datetime 형식)을 사용하여 2 개의 그림을 플로팅하고 싶습니다.
다음 코드를 수행했습니다.
fig=plt.figure()
fig.set_size_inches(10,10)
plt.subplot(211)
plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%H:%M:%S'))
plt.gca().xaxis.set_major_locator(dates.MinuteLocator())
plt.plot(WaveLab_df['Time'],WaveLab_df['Active_Power_Starboard_W'])
plt.plot(WaveLab_df['Time'],WaveLab_df['Active_Power_Portside_W'])
plt.gcf().autofmt_xdate()
plt.subplot(212)
plt.plot(df_tempS['DateTime'],df_tempS['Power[W]'])
사실 두 번째 플롯에서 동일한 유형의 x 레이블 (시간-분)을 사용하고 싶습니다. 각 플롯에 대해 x 축을 원합니다.
다른 조합을 시도했지만 성공하지 못했습니다.
누구 아이디어로?
감사 !
두 서브 플롯 모두 에서 포맷터와 로케이터를 사용해야합니다 .
fig=plt.figure()
fig.set_size_inches(10,10)
plt.subplot(211)
plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%H:%M:%S'))
plt.gca().xaxis.set_major_locator(dates.MinuteLocator())
plt.plot(WaveLab_df['Time'],WaveLab_df['Active_Power_Starboard_W'])
plt.plot(WaveLab_df['Time'],WaveLab_df['Active_Power_Portside_W'])
plt.gcf().autofmt_xdate()
plt.subplot(212)
plt.plot(df_tempS['DateTime'],df_tempS['Power[W]'])
plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%H:%M:%S'))
plt.gca().xaxis.set_major_locator(dates.MinuteLocator())
plt.gcf().autofmt_xdate()
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다