import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import numpy as np
x = np.array( [0,1,2,3,4,5,6,7,8,9] )
y = np.array( [10,11,12,13,4,5,6,7,8,9] )
plt.plot(x,y,”r-o”)
#red紅色 線型- marker:o
yMinIdx = np.argmin(y)
minY= y [yMinIdx]
#print(yMinIdx)
#print(y[yMinIdx] )
yMaxIdx = np.argmax(y)
maxY= y [yMaxIdx]
#print(yMaxIdx)
#print(y[yMaxIdx] )
plt.plot( [x[0], x[yMinIdx]],[minY,minY],”b–s”)
#plt.plot(x[0],y[yMinIdx],”bs”)
plt.plot( [x[0],x[yMaxIdx]],[maxY,maxY],”b–s”)
#plt.plot(x[0],y[yMaxIdx],”bs”)
annot_min = “(%3.1f,%3.1f)” %(yMinIdx,minY)
annot_max = “(%3.1f,%3.1f)” %(yMaxIdx,maxY)
plt.annotate(annot_min,(yMinIdx,minY))
plt.annotate(annot_max,(yMaxIdx,maxY))

繪出結果:

通用屬性:

linestyle:

圖例 legend

set_title()、set_xlabel()、set_ylabel()

ax.grid(visible=None, axis=’both’, …)
ax.set_xticks()
ax.set_yticks()

ax.annotate(text,xy,…)

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


![Python TQC考題404 數字反轉判斷,n_rev=n[::-1], list1.reverse() Python TQC考題404 數字反轉判斷,n_rev=n[::-1], list1.reverse()](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/04/20220825152414_97.png?quality=90&zoom=2&ssl=1&resize=350%2C233)
![Python: 如何判斷字符串內容是否為數字(整數或浮點數)? isinstance( eval( entry.get() ), (float, int) ) ; str.isdigit() #不包括小數點和負號 ; try~ except ValueError~ ; 正則表示法 regular expression ; pattern = ‘^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$’ Python: 如何判斷字符串內容是否為數字(整數或浮點數)? isinstance( eval( entry.get() ), (float, int) ) ; str.isdigit() #不包括小數點和負號 ; try~ except ValueError~ ; 正則表示法 regular expression ; pattern = ‘^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$’](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2023/05/20230512152430_3.png?quality=90&zoom=2&ssl=1&resize=350%2C233)




![Python Logging 完全指南:從基礎到實戰應用; import logging ; logging.basicConfig(level=logging.INFO, handlers=[ logging.StreamHandler(), logging.FileHandler(‘app.log’, mode=’a’, encoding=’utf-8′)] ) ; inspect.currentframe().f_code.co_name #動態取得funcName Python Logging 完全指南:從基礎到實戰應用; import logging ; logging.basicConfig(level=logging.INFO, handlers=[ logging.StreamHandler(), logging.FileHandler(‘app.log’, mode=’a’, encoding=’utf-8′)] ) ; inspect.currentframe().f_code.co_name #動態取得funcName](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2025/10/20251021155823_0_c16012.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

近期留言