0
的中间使蜱下面的代码生成一个矩阵图即它的每一平方索引与从1号的中间至39:matshow python中与盘区,在正方形
import numpy as np
from matplotlib import pyplot as plt
a=np.random.uniform(0,1,1600).reshape((40,40))
fig, ax = plt.subplots(1,1)
ax.matshow(a, vmin = 0, vmax = 1, interpolation = 'none')
label_list=np.arange(0,40,5)
label_list=np.append(label_list,39)
ax.set_xticks(label_list)
ax.set_yticks(label_list)
plt.show()
当我想要将数字更改为0
和1.95
或基本上[0,39]*0.05
时,标签缩小到轴的起点。如果我尝试在matshow
中使用范围,那么标签不会指向正方形的中间位置!我怎样才能使这个浮动指数指向广场的中间?
更改标签而不更改标记。 – cphlewis 2015-04-03 20:27:59
这似乎工作!谢谢! – Cupitor 2015-04-03 20:30:38