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 Pandas GroupBy 的 size 陷阱:為什麼你的計數結果總是不對?如何計算重複次數? duplicates = df.duplicated( subset = [‘name’] ) Python Pandas GroupBy 的 size 陷阱:為什麼你的計數結果總是不對?如何計算重複次數? duplicates = df.duplicated( subset = [‘name’] )](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2025/06/20250609143758_0_53821c.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python如何寫入docx文件? from docx import Document ; doc = Document() ; table = doc.add_table(rows=5, cols=3) ; table.cell(r,c).text = str(tabs[r][c]) ; doc.add_heading ; p = doc.add_paragraph ; p.add_run ; doc.add_picture ; 使用wordPad開啟會少最後一個row,可以用免費的LibreOffice Python如何寫入docx文件? from docx import Document ; doc = Document() ; table = doc.add_table(rows=5, cols=3) ; table.cell(r,c).text = str(tabs[r][c]) ; doc.add_heading ; p = doc.add_paragraph ; p.add_run ; doc.add_picture ; 使用wordPad開啟會少最後一個row,可以用免費的LibreOffice](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/09/20220914154313_30.jpg?quality=90&zoom=2&ssl=1&resize=350%2C233)


近期留言