mcetl.plotting.plotting_gui

GUIs to plot data using various plot layouts and save the resulting figures.

@author: Donald Erb Created on Jun 28, 2020

mcetl.plotting.plotting_gui.COLORS

A tuple with values that are used in GUIs to select the color to plot with in matplotlib. The default is ('None', 'Black', 'Blue', 'Red', Green', 'Chocolate', 'Magenta', 'Cyan', 'Orange', 'Coral', 'Dodgerblue').

Type

tuple(str, ..)

mcetl.plotting.plotting_gui.LINE_MAPPING

A dictionary with keys that are displayed in GUIs, and values that are used by matplotlib to specify the line style. The default is {

'None': '', 'Solid': '-', 'Dashed': '--', 'Dash-Dot': '-.', 'Dot': ':', 'Dash-Dot-Dot': (0, [0.75 * plt.rcParams['lines.dashdot_pattern'][0]] +

plt.rcParams['lines.dashdot_pattern'][1:] + plt.rcParams['lines.dashdot_pattern'][-2:])

}

Type

dict

mcetl.plotting.plotting_gui.MARKERS

A tuple of strings for the default markers to use for plotting. The default is (' None', 'o Circle', 's Square', '^ Triangle-Up', 'D Diamond', 'v Triangle-Down', 'p Pentagon', '< Triangle-Left', '> Triangle-Right', '* Star').

Type

tuple(str, ..)

mcetl.plotting.plotting_gui.TIGHT_LAYOUT_PAD

The padding placed between the edge of the figure and the edge of the canvas; used by matplotlib's tight_layout option. Default is 0.3.

Type

float

mcetl.plotting.plotting_gui.TIGHT_LAYOUT_H_PAD

The height (vertical) padding between axes in a figure; used by matplotlib's tight_layout option. Default is 0.6.

Type

float

mcetl.plotting.plotting_gui.TIGHT_LAYOUT_W_PAD

The width (horizontal) padding between axes in a figure; used by matplotlib's tight_layout option. Default is 0.6.

Type

float

Module Contents

Functions

launch_plotting_gui

Convenience function to plot lists of dataframes with matplotlib.

load_previous_figure

Load the options and the data to recreate a figure.

mcetl.plotting.plotting_gui.launch_plotting_gui(dataframes=None, mpl_changes=None, input_fig_kwargs=None, input_axes=None, input_values=None)

Convenience function to plot lists of dataframes with matplotlib.

Wraps the plotting in a context manager that applies the changes to the matplotlib rcParams.

Parameters
  • dataframes (list(list(pd.DataFrame))) -- A nested list of lists of pandas DataFrames. Each list of DataFrames will create one figure.

  • mpl_changes (dict) -- Changes to matplotlib's rcParams file to alter the figure.

  • input_fig_kwargs (dict, optional) -- The fig_kwargs from a previous session. Only used if reloading a figure.

  • input_axes (dict, optional) -- A dictionary of plt.Axes objects from a reloaded session.

  • input_values (dict, optional) -- The values needed to recreate the previous gui window from a reloaded figure.

Returns

figures -- A nested list of lists, with each entry containing the matplotlib Figure, and a dictionary containing the Axes.

Return type

list(list(plt.Figure, dict(str, plt.Axes)))

mcetl.plotting.plotting_gui.load_previous_figure(filename=None, new_rc_changes=None)

Load the options and the data to recreate a figure.

Parameters
  • filename (str, optional) -- The filepath string to the csv data file to be opened.

  • new_rc_changes (dict, optional) -- New changes to matplotlib's rcParams file to alter the saved figure.

Returns

figures -- A list of figures (with len=1) using the loaded data. If no file is selected, then figures = None.

Return type

list or None

Notes

Will load the data from the csv file specified by filename. If there also exists a .figjson file with the same name as the csv file, it will be loaded to set the figure layout. Otherwise, a new figure is created.