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