matplot 一张图的主要格式设置(含图示)
Title

ax.set_title(f'{title[i]}', y=-0.2, fontsize=22)
设置格式
current_title = ax.get_title()
ax.set_title(current_title, fontsize=16)
X, Y lable

ax.set_xlabel(r"$k$", fontsize=22, labelpad=14)
ax.set_ylabel("Influence Coverage (%)", fontsize=22, labelpad=14)
设置格式
current_xlabel = ax.get_xlabel()
current_ylabel = ax.get_ylabel()
ax.set_xlabel(current_xlabel, fontsize=22, labelpad=14)
ax.set_ylabel(current_ylabel, fontsize=22, labelpad=14)
设置坐标轴

# 设置x, y范围
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
设置坐标轴主刻度
# 设置主刻度线
ax0.yaxis.set_major_locator(MultipleLocator(0.1))
设置坐标轴格式
# 设置坐标轴
ax.tick_params(which='major', labelsize=18, length=3, width=1, direction='in')
隐藏刻度线和轴标签
# 去除刻度线和轴标签
ax.set_xticks([])
ax.set_yticks([])
ax.set_xticklabels([])
ax.set_yticklabels([])
设置边框线

# 设置图框线粗细
bwith = 3.5 # 边框宽度设置为1
TK = fig.sca(ax) # 获取边框
TK.spines['bottom'].set_linewidth(bwith) # 图框下边
TK.spines['bottom'].set_color('black')
TK.spines['left'].set_linewidth(bwith) # 图框左边
TK.spines['left'].set_color('black')
TK.spines['top'].set_linewidth(bwith) # 图框上边
TK.spines['top'].set_color('black')
TK.spines['right'].set_linewidth(bwith) # 图框右边
TK.spines['right'].set_color('black')

浙公网安备 33010602011771号