簡體   English   中英

如何將 df.plot.line() 排列成子圖

[英]How to arrange df.plot.line() into subplots

我有幾個只有數字列的 DF。 我正在使用 df.plot.line() 來查看數據,它在單獨繪制圖形時工作正常。

現在我正在嘗試一種將這些圖形排列成子圖的方法,但我找不到方法。

這是一個例子:

df_km_cumsum.plot.line(figsize=[20,15],legend=False)

給出這個情節

df_daytot_km.plot.line(figsize=[20,15],legend=False)

給出另一個情節

現在我想把它們放在一個 2x1 的圖形中,讓它們一起看到。

歡迎任何幫助。 謝謝

plt.subplot(2, 1, 1)
df_km_cumsum.plot.line(figsize=[20,15],legend=False)

plt.subplot(2, 1, 2)
df_daytot_km.plot.line(figsize=[20,15],legend=False) 

感謝@tmdavision,這是最終的解決方案:

fig, (ax1, ax2) = plt.subplots(2,figsize=[20,15])

df_km_cumsum.plot.line(legend=False, ax=ax1)

df_dayavg_km.plot.line(legend=False, ax=ax2)

plt.show()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM