簡體   English   中英

我如何更改 plot 以使其從左角開始並在右角結束(我希望這是有道理的)

[英]How do I change the plot so that it starts at the left corner and ends and the right corner (I hope this make sense)

我被要求盡可能准確地重現 plot。 這是我必須重現的 plot

在此處輸入圖像描述

這是我用於 plot 圖表的代碼

fig=plt.figure(figsize=(18,5))
plt.plot (df.Volume, color='black', label = 'APPL')
plt.plot (df.Volume_moving, '--', color = 'black')
plt.plot (df2.Volume, color='red', label = 'GOOG')
plt.plot (df2.Volume_moving, '--', color = 'red')
axes = plt.gca()
axes.set_ylim([0,50000000])
plt.legend(loc='upper right',fontsize =12);
plt.xlabel ('Days since Oct 15th', fontsize =15)
plt.ylabel ('Volume Traded(Million Shares)', fontsize= 15)

目前我的圖表看起來像這樣在此處輸入圖像描述

我想問的是數據是否可以像例子一樣從左角開始到右角結束。

除此之外,如果你們不介意的話,我想問一下我怎樣才能像這個例子那樣在我的圖例周圍加上邊框。 以及如何像示例一樣在左上角寫相關性。

你應該試試:

axes.set_xlim([df.index[0], df.index[-1]])

暫無
暫無

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

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