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 檢驗字符串格式:掌握正則表達式(Regular Expression)的起始^與終止$符號, pattern = r’^GATR[0-9]{4}$’ 使用 Python 檢驗字符串格式:掌握正則表達式(Regular Expression)的起始^與終止$符號, pattern = r’^GATR[0-9]{4}$’](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2024/07/20240712093637_0.png?quality=90&zoom=2&ssl=1&resize=350%2C233)


近期留言