import matplotlib.pyplot as plt
import numpy as np
# image data
# 定义一个矩阵,也就是图片的像素点
a = np.array([0.313660827978, 0.365348418405, 0.423733120134,
0.365348418405, 0.439599930621, 0.525083754405,
0.423733120134, 0.525083754405, 0.651536351379]).reshape(3,3)
"""
for the value of "interpolation", check this:
http://matplotlib.org/examples/images_contours_and_fields/interpolation_methods.html
for the value of "origin"= ['upper', 'lower'], check this:
http://matplotlib.org/examples/pylab_examples/image_origin.html
"""
# interpolation是一种图片显示方式,如果你想其他的显示风格,上面有链接,你可以看一下。
plt.imshow(a, interpolation='nearest', cmap='bone', origin='lower')
plt.colorbar(shrink=.92) # 设置一个颜色指引条
plt.xticks(())
plt.yticks(())
plt.show()