-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10_Image.py
More file actions
29 lines (25 loc) · 1.08 KB
/
10_Image.py
File metadata and controls
29 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
#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
"""
# 图片的输入
# 好像是默认最值点为黑白,然后在中间等分颜色
plt.imshow(a, # 传入的数组
interpolation='nearest', # 在网站上有具体的,这个就是边界分明的
cmap='bone', # cmap=plt.cm.hot 也可以直接像这样子传入字符串
origin='lower') # 相对于upper,upper和上边那个一一对应
# 颜色标注
plt.colorbar(shrink=.92) # shrink:压缩到了左边图片长度的90%
plt.xticks(())
plt.yticks(())
plt.show()