170622 Save plot to image file instead of displaying it using Matplotlib

来源:互联网 发布:网络连接中断请联系isp 编辑:程序博客网 时间:2024/06/05 18:31

Issue description
Answer as following
这里写图片描述
Code

import matplotlib.pyplot as pltimport numpy as npimport matplotlib.cm as cmfor i in range(10):    data = np.random.randint(1,99,(10,10))    plt.ioff() # prevent showing the picture    plt.matshow(data,cmap=cm.RdYlGn) # plot the picture    plt.savefig('rms_map//'+str(i)+'.png')

这里写图片描述

Color Example
https://matplotlib.org/examples/color/colormaps_reference.html
Gitbook Resource
https://www.gitbook.com/@wizardforcel

阅读全文
0 0
原创粉丝点击