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: pandas.Series如何只保留str,去除重複值?#isinstance(x:Any, str) -> bool #.drop_duplicates() #Series.apply( function )逐元素應用function運算 #DataFrame.apply( function )逐Series應用function運算 .drop_duplicates() 跟.unique()有何差別? df.drop_duplicates() 等效於 df[~df.duplicated()] Python: pandas.Series如何只保留str,去除重複值?#isinstance(x:Any, str) -> bool #.drop_duplicates() #Series.apply( function )逐元素應用function運算 #DataFrame.apply( function )逐Series應用function運算 .drop_duplicates() 跟.unique()有何差別? df.drop_duplicates() 等效於 df[~df.duplicated()]](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2024/11/20241123194900_0_5218de.png?quality=90&zoom=2&ssl=1&resize=350%2C233)




]*>.*?底下插入一個圖檔.*?</w:p>’, flags = re.DOTALL) ; new_xml, n = pattern.subn(”, xml, count=1)' title='Python正則替換:全面掌握 re.sub 與 re.subn 的差異與實戰 #substitute(替換); . 預設匹配「除\n以外的任意單一字元」; pattern = re.compile(r'<w:p[^>]*>.*?底下插入一個圖檔.*?</w:p>’, flags = re.DOTALL) ; new_xml, n = pattern.subn(”, xml, count=1)' loading='lazy' width=350 height=233 />



近期留言