plt.axis([xmin, xmax, ymin, ymax])
![Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax]) - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2023/02/20230208101745_93.jpg)
plt.xlim([xmin, xmax])
plt.ylim([ymin, ymax])
![Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax]) - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2023/02/20230208102115_62.png)
畫Max-mean & Min-mean vs dist的圖
import matplotlib.pyplot as plt
fig,ax = plt.subplots()
ax.plot(dist, max_mean, label=”Max-mean”)
ax.plot(dist, min_mean, label=”Min-mean”)
# lisLim = [dist[0],dist[-1],
# max(max_mean),min(min_mean)]
# plt.axis(lisLim)
ax.legend()
plt.minorticks_on()
ax.grid(visible=True,which=”major”,c=”k”,linewidth=1) ;
ax.grid(visible=True,which=”minor”,c=”k”,linewidth=0.5)
tit = “FF Different Position Max or Min – mean “
ax.set_title(tit)
figpath = os.path.join(figFolder, tit+”.png”)
fig.savefig(figpath)
![Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax]) - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2023/02/20230208102414_59.png)
先看103~105註解掉的情況
(會留buffer)
![Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax]) - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2023/02/20230208102540_48.png)
#新增:
lisLim = [dist[0],dist[-1],
max(max_mean),min(min_mean)]
plt.axis(lisLim)
#無buffer:
![Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax]) - 儲蓄保險王](https://savingking.com.tw/wp-content/uploads/2023/02/20230208102644_88.png)
推薦hahow線上學習python: https://igrape.net/30afN


![Python如何讀寫csv逗點分隔檔(每列內容為新光增有利現金流)?pandas.read_csv(r”路徑\檔名.副檔名”),如何移除list中的nan元素?math.isnan(),如何計算新光增有利IRR?numpy_financial(array) ;輸出csv檔時如何去掉index跟header?如何選擇要寫入的直欄columns? dfFinal.to_csv(fpath, index=False, header=None, columns=[0,1]) Python如何讀寫csv逗點分隔檔(每列內容為新光增有利現金流)?pandas.read_csv(r”路徑\檔名.副檔名”),如何移除list中的nan元素?math.isnan(),如何計算新光增有利IRR?numpy_financial(array) ;輸出csv檔時如何去掉index跟header?如何選擇要寫入的直欄columns? dfFinal.to_csv(fpath, index=False, header=None, columns=[0,1])](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221110122900_3.png?quality=90&zoom=2&ssl=1&resize=350%2C233)







近期留言