import matplotlib.pyplot as plt
y = 6
xmin = 0
xmax = 5
plt.hlines(y, xmin, xmax,color=”b”)
x = 7
ymin = 0
ymax = 8
plt.vlines(x, ymin, ymax,color=”r”)


axhline, axvline
matplotlib.pyplot.axhline(y=0, xmin=0, xmax=1, **kwargs)
y
float, default: 0
y position in data coordinates of the horizontal line.
xmin
float, default: 0
Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.
xmax
float, default: 1
Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.

axhline設定xmin,xmax的效果:

plt.axline((0, 0), (1, 1), linewidth=1, color=’r’)

推薦hahow線上學習python: https://igrape.net/30afN
使用 plt.text() 函数在图上添加文本注释
plt.text(0, -3.2, “max-3B”, ha=”center”, va=”top”, fontsize=12):

plt.text() 函数的第一个参数是 x 坐标,
第二个参数是 y 坐标,
这里的 (0, -3.2) 是希望把文本放在
横坐标为 0,
纵坐标为 -3.2 的位置。
ha 参数是文本水平对齐方式,
va 参数是文本垂直对齐方式,
fontsize 参数是文本字体大小。
推薦hahow線上學習python: https://igrape.net/30afN

![Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str] Python常用的模組內建常數; __name__ ; __file__ ; __doc__ ; __all__ ;__dict__; vars()->Dict[str,str] ; dir()->List[str]](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221112184006_50.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python TQC考題604 眾數, cnt[L.index(n)]+=1, L[cnt.index(max(cnt))], if L.count(n)>maxcnt: Python TQC考題604 眾數, cnt[L.index(n)]+=1, L[cnt.index(max(cnt))], if L.count(n)>maxcnt:](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2022/04/20220430181911_73.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://i0.wp.com/savingking.com.tw/wp-content/uploads/2022/09/20220914154313_30.jpg?quality=90&zoom=2&ssl=1&resize=350%2C233)





近期留言