Saving image which is displayed using peek() in python -


  import matplotlib.pyplot plt   import sunpy.spectra   import sunpy.data.sample   sunpy.spectra.sources.callisto import callistospectrogram   image = callistospectrogram.read(sunpy.data.sample.callisto_image)   image.peek() 

then how save image using command?

i don't have sunpy environment test on, can give following shot?

import matplotlib matplotlib.use('agg') import matplotlib.pyplot plt import sunpy.spectra import sunpy.data.sample sunpy.spectra.sources.callisto import callistospectrogram image = callistospectrogram.read(sunpy.data.sample.callisto_image) image.plot() plt.savefig('myfig') 

based on generate images without having window appear:

the easiest way use non-interactive backend (see backend?) such agg (for pngs), pdf, svg or ps. in figure-generating script, call matplotlib.use() directive before importing pylab or pyplot:

import matplotlib matplotlib.use('agg') import matplotlib.pyplot plt plt.plot([1,2,3]) plt.savefig('myfig') 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -