Use the LogFormatter class and set labelOnlyBase to False:import matplotlib.pyplot as pltimport numpy as npimport matplotlib.colorsfrom matplotlib.ticker import LogFormatterA = np.random.rand(50,50)*50plt.imshow(A, norm=matplotlib.colors.LogNorm())formatter = LogFormatter(10, labelOnlyBase=False)cb = plt.colorbar(ticks=[1,5,10,20,50], format=formatter)plt.show() 这篇关于颜色条上的日志标签matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-05 11:57