# ===
# === figsize, linewith
# ===
# 字体设置
plt.rc('lines', lw = 4)
font = {'size' : '20'}
plt.rc('font', **font)
# 方图:
plt.figure(figsize = (12, 10))
# 线宽
lw = 3 # 喜好设置 lw = 3 左右
ms = 10 # markersize 为 10 左右
# ===
# === useful colors and markers
# ===
color = ['r', 'green', 'orange', 'dodgerblue', 'darkmeganta'] # 一些好的配色
markers = ['o', 'p', 's', 'd', '*']
# ===
# === plt.plot parameter
# ===
plt.loglog(dt, phih_err[i], label = lb[i], ls = ls[i], marker = mk[i], \
color = color[i], lw = lw, markerfacecolor = facec[i], markeredgewidth = 3, \
markersize = mkss[i], markevery = 4, nonposy = 'mask') # plot 函数参数,同样试用于 plt.plot, semilogy 等
'''
Tips: nonposy = 'mask' 参数表示如果出现负数时, 自动忽略该点.
'''
# ===
# === legend 函数
# ===
plt.legend(fontsize = fs, edgecolor = 'None', facecolor = 'None' \
shadow = False, handlelength=2.5, loc = 'best')
# ===
# === 设置坐标轴刻度大小, 以及范围
# ===
plt.tick_params(labelsize = tick_size)
plt.xticks(points, ticks)
# 设置 x 轴标记以及哪些点要绘制标记,两个都可以输入数组
Matplotlib 一些喜欢的绘图参数整理
最新推荐文章于 2024-07-12 16:26:12 发布