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

阅读 16

2023-03-03


​​Issue description​​

Answer as following

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


Code

import matplotlib.pyplot as plt
import numpy as np
import matplotlib.cm as cm

for 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')

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

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


精彩评论(0)

0 0 举报