pwtools.mpl.prepare_plots

pwtools.mpl.prepare_plots(names, projection='2d', **kwds)[source]

Return a dict of Plot instances.

Parameters:
  • names (sequence) – keys for the dict, e.g. [1,2] or [‘plot1’, ‘plot2’]

  • projection (str) – type of plot; {‘2d’,’3d’}

  • kwds (keywords passed to fig_ax() or fig_ax3d() which are internally used) –

Examples

>>> plots = prepare_plots(['etot', 'ekin'])
>>> plots['etot'].ax.plot(etot)
>>> plots['ekin'].ax.plot(ekin)
>>> for key,pp in plots.iteritems():
...     pp.ax.set_title(key)
...     pp.fig.savefig(key+'.png')