攝影或3C

Python: matplotlib繪圖,如何限定座標軸範圍? plt.axis([xmin, xmax, ymin, ymax])

plt.axis([xmin, xmax, ymin, ymax])

plt.xlim([xmin, xmax])
plt.ylim([ymin, ymax])

畫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)

先看103~105註解掉的情況

(會留buffer)

#新增:

lisLim = [dist[0],dist[-1],
max(max_mean),min(min_mean)]
plt.axis(lisLim)

#無buffer: 

推薦hahow線上學習python: https://igrape.net/30afN

儲蓄保險王

儲蓄險是板主最喜愛的儲蓄工具,最喜愛的投資理財工具則是ETF,最喜愛的省錢工具則是信用卡