用python画出来的热力图坐标轴上只有刻度线,没有数字
代码如下:
import seaborn
from matplotlib import pyplot
import pandas
df = pandas.read_csv("0.csv",encoding='utf-8')
ax = seaborn.heatmap(df,cmap = 'viridis',vmax = 1.0,vmin = 0.0)
xmajorLocator = pyplot.MultipleLocator(10)
ymajorLocator = pyplot.MultipleLocator(10)
ax.xaxis.set_major_locator(xmajorLocator)
ax.yaxis.set_major_locator(ymajorLocator)
pyplot.show()
结果如下:
去掉以下两行代码可以显示数字了,但是很紧密:
ax.xaxis.set_major_locator(xmajorLocator)
ax.yaxis.set_major_locator(ymajorLocator)
如何修改才能在横纵坐标上每隔10显示刻度线和数字呢?就像下图这样:
试试这个行不行
https://blog.csdn.net/weixin_44520259/article/details/89917026