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.read_excel(r”路徑\檔名.副檔名”, header = None), 自動加上0,1…的欄標籤, DataFrame如何取某一直欄或橫列? 如何用 .iloc[bool_list] 取出判斷式為真的那一列? bool_list = list( df[0] == 0 ) ; bool_list = list(df[0].isin([0])) ; DataFrame如何顯示完整的資料? pandas.set_option ( “display.max_rows”, None) Python: pandas.read_excel(r”路徑\檔名.副檔名”, header = None), 自動加上0,1…的欄標籤, DataFrame如何取某一直欄或橫列? 如何用 .iloc[bool_list] 取出判斷式為真的那一列? bool_list = list( df[0] == 0 ) ; bool_list = list(df[0].isin([0])) ; DataFrame如何顯示完整的資料? pandas.set_option ( “display.max_rows”, None)](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221128164005_44.png?quality=90&zoom=2&ssl=1&resize=350%2C233)





近期留言