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 讀取 DOCX 圖片關聯:qn+find/findall 與 XPath 的實戰對照 from lxml import etree ; from docx.oxml.ns import qn; lxml.etree._Element.findall( f”.//{ qn(‘a:blip’) }” ) ; .get( qn(“r:embed”) ) #獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’) ; lxml.etree._Element.xpath( “//a:blip/@r:embed”, namespaces = NS) #/@r:embed = 獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’),使用.findall() 要先.findall()獲取List[_Element],再迴圈_Element.get()獲取屬性值, .xpath() 第一個參數path 使用”//a:blip/@r:embed” ,可直接獲取屬性值(List[str]如: [‘rId4’, ‘rId5’]) ; 如何對docx真實移除圖片瘦身? Python 讀取 DOCX 圖片關聯:qn+find/findall 與 XPath 的實戰對照 from lxml import etree ; from docx.oxml.ns import qn; lxml.etree._Element.findall( f”.//{ qn(‘a:blip’) }” ) ; .get( qn(“r:embed”) ) #獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’) ; lxml.etree._Element.xpath( “//a:blip/@r:embed”, namespaces = NS) #/@r:embed = 獲取 屬性名 ‘r:embed’ 的 屬性值(如: ‘rId4’),使用.findall() 要先.findall()獲取List[_Element],再迴圈_Element.get()獲取屬性值, .xpath() 第一個參數path 使用”//a:blip/@r:embed” ,可直接獲取屬性值(List[str]如: [‘rId4’, ‘rId5’]) ; 如何對docx真實移除圖片瘦身?](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2025/11/20251119130848_0_3fbf6b.png?quality=90&zoom=2&ssl=1&resize=350%2C233)







近期留言