python - Pandas save plot to file and don't show on the screen -


i'm making plots of fitted data , saving them files nicely with.

# make main plot. ax = df.plot(x=df.x, y=['counts', 'fit', 'res'], title=save_file_name,         style=['b', 'g--', 'r'], xlim=xlim, ylim=ylim) # on plot individual gaussians fit_gaussians dataframe. i, fit_gaus in fit_gaussians.iterrows():     plt.plot(df.x, gaussian(df.x, fit_gaus.h, fit_gaus.mu,             fit_gaus.sigma), 'y', linestyle='--') # save file. fig = ax.get_figure() fig.savefig('test.ps') 

this works great, opens window , plots screen. know can use matplotlib directly recreate i'm doing df.plot, , never call plt.show, feel there should way create plot in file pandas out opening window.

if don't want pop ups can %matplotlib inline otherwise before define ax do:

plt.ioff()

then whenever want show can plt.show()


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -