def plot_wrapper( h5file, solution, *args, title=None, filename=None, figargs=None, mpl_style=DEFAULT_MPL_STYLE, with_version=True, **kwargs ): """ Wraps plot functions """ if solution is None: solution = "0" if filename is None: filename = "{}:{}".format( h5file.config_filename, h5file.config_input.label ) if figargs is None: figargs = {} with use_style(mpl_style): fig = plt.figure(constrained_layout=True, **figargs) func( fig, get_solutions(h5file, solution), *args, use_E_r=h5file.use_E_r, **kwargs ) if title is None: fig.suptitle("{}:{}".format(filename, solution)) else: fig.suptitle(title) if with_version: add_version_to_plot(fig) return fig
def conserve_plot(solutions, *, plot_filename=None, show=False, start=0, stop=90, figargs=None, title=None, linestyle='-', close=True, mpl_style=DEFAULT_MPL_STYLE, use_E_r=False, with_version=True): """ Plot solution to file, with velocities, fields onto on one plot """ # pylint: disable=unused-argument with use_style(mpl_style): fig = generate_conserve_plot( solutions, start=start, stop=stop, figargs=figargs, linestyle=linestyle, ) if title is None: fig.suptitle("Conservation of $ρ v_θ$") else: fig.suptitle(title) if with_version: add_version_to_plot(fig) return plot_output_wrapper(fig, file=plot_filename, show=show, close=close)
def plot_wrapper( solution_pairs, *args, title=None, figargs=None, mpl_style=DEFAULT_MPL_STYLE, with_version=True, num_solutions=None, **kwargs ): """ Wraps plot functions """ if figargs is None: figargs = {} if num_solutions is None: num_solutions = len(solution_pairs) def solution_loader(solns): for run, name, filename in solns: if filename is None: filename = "{}:{}".format( run.config_filename, run.config_input.label ) soln = get_solutions(run, name) if soln is None: logger.warning("{} not in {}".format(name, filename)) continue soln_name = "{}:{}".format(filename, name) yield soln_name, soln with use_style(mpl_style): fig = plt.figure(constrained_layout=True, **figargs) func( fig, solution_loader(solution_pairs), *args, num_solutions=num_solutions, **kwargs ) if title is not None: fig.suptitle(title) if with_version: add_version_to_plot(fig) return fig
def diverge_plot( solutions, *, plot_filename=None, show=False, start=0, stop=90, figargs=None, title=None, linestyle='-', with_slow=False, close=True, mpl_style=DEFAULT_MPL_STYLE, with_version=True ): """ Plot solution to file, with velocities, fields onto on one plot """ with use_style(mpl_style): fig = generate_diverge_plot( solutions, start=start, stop=stop, figargs=figargs, linestyle=linestyle, with_slow=with_slow, ) if title is None: fig.suptitle("Comparison of v_θ") else: fig.suptitle(title) if with_version: add_version_to_plot(fig) return plot_output_wrapper( fig, file=plot_filename, show=show, close=close )
'figure.facecolor' : '0.85', # figure facecolor; 0.75 is scalar gray 'figure.edgecolor' : '0.50', # figure edgecolor 'keymap.fullscreen': 'f', # toggling 'keymap.home': ['h', 'r', 'home'], # home or reset mnemonic 'keymap.back': ['left', 'c', 'backspace'], # forward / backward keys to enable 'keymap.forward': ['right', 'v'], # left handed quick navigation 'keymap.pan': 'p', # pan mnemonic 'keymap.zoom': 'o', # zoom mnemonic 'keymap.save': 's', # saving current figure 'keymap.grid': 'g', # switching on/off a grid in current axes 'keymap.yscale': 'l', # toggle scaling of y-axes ('log'/'linear') 'keymap.xscale': ['L', 'k'], # toggle scaling of x-axes ('log'/'linear') 'keymap.all_axes': 'a', # enable all axes 'contour.negative_linestyle': 'dashed' } use_style(params) try: reload(cm) reload(common) reload(dynamics) reload(file) reload(gis) reload(graphics) reload(interpolate) reload(signal) reload(stats) except: import cm
'p', # pan mnemonic 'keymap.zoom': 'o', # zoom mnemonic 'keymap.save': 's', # saving current figure 'keymap.grid': 'g', # switching on/off a grid in current axes 'keymap.yscale': 'l', # toggle scaling of y-axes ('log'/'linear') 'keymap.xscale': ['L', 'k'], # toggle scaling of x-axes ('log'/'linear') 'keymap.all_axes': 'a', # enable all axes 'contour.negative_linestyle': 'dashed' } use_style(params) try: reload(cm) reload(common) reload(dynamics) reload(file) reload(gis) reload(graphics) reload(interpolate) reload(signal) reload(stats) except: import cm import common