1 Set the width of the colorbar color interval line
dividers
Set the width of the colorbar color interval line by attribute
# 将drawedges设置为True,从而显示颜色之间的分界线
cbar = fig.colorbar(im, ax=axs, orientation='horizontal', ticks=bins, drawedges=True)
# 利用属性dividers设置宽度
cbar.dividers.set_linewidth(1.0)
# 利用属性outline设置宽度
cbar.outline.set_linewidth(1.0)
If not set dividers
, the result is as follows:
If set dividers
, the result is as follows:
2 Set the width of the outer border of the colorbar
outline
Set the width of the outer border of the colorbar through attributes
# 通过下列代码进行设置
cbar.outline.set_linewidth(1.0)
cbar.update_ticks()