fusion-energy / openmc_source_plotter

A Python package for extracting and plotting the locations, directions, energy distributions of OpenMC source particles
MIT License
10 stars 3 forks source link

save plots directly with path instead of just displaying #43

Open mcon157 opened 5 months ago

mcon157 commented 5 months ago

Hello, I was just wondering if there was any method of saving png's directly with a given path and filename instead of plot.show(). Thanks

shimwell commented 5 months ago

Hi @mcon157

Yes you can do this with .savefig as the return object is a matplotlib object

See this example

https://github.com/fusion-energy/openmc_source_plotter/blob/b755b12bc7753c9bf8de0fa72593dd279bcc1e83/examples/example_gamma_spec_plot.py#L18-L20