pyretis.inout.plotting package

This package contains functions for setting up plotters.

Specifically it defines colors, color schemes and a function for selecting a plotter.

Here we also hard-code some color schemes which may be useful for the plotting:

  • the colorblind 10 scheme [cb10],
  • the deep color scheme from the seaborn project [deep] and
  • the husl color scheme [husl].

Package structure

This file, handles imports for PyRETIS and defines some colors and the method for creating a plotter. (pyretis.inout.plotting.mpl_plotting)
Methods for generating plots using matplotlib. (pyretis.inout.plotting.plotting)
Definition of a generic base class for the plotter(s).

Important methods defined here

create_plotter (create_plotter())
Method to create a plotter.


This folder contains style files for matplotlib which are used by PyRETIS.


[cb10]The colorblind_10 color scheme,
[deep]The deep color scheme, from the seaborn project
[husl]The husl color scheme,
pyretis.inout.plotting.create_plotter(plot_settings, out_dir=None)[source]

Function to create a plotter.

The input plot settings is assumed to be a dictionary which we use for creating the plotter. In case the plot settings is not given, we just return None. We are here assuming that they are not given simply because we do not want to create a plotter.

  • plot_settings (dict) – These are the settings to create the plotter from. Here, we look for the keys plotter, output and style which defines the plotter to use, the output format and the style to use.
  • out_dir (string, optional) – This string selects if and where the output should be written to. It’s mainly used for internal purposes to save the report files to a specific directory.

out – This is a object which can be used for plotting.

Return type:

object like MplPlotter

pyretis.inout.plotting.mpl_plotting module

Functions for generating plots using matplotlib.

This module defines a plotter class for matplotlib and it also defines some standard plots that are used in the analysis.

Important classes defined here

MplPlotter (MplPlotter)
A class for plotting with matplotlib.

Important methods defined here

mpl_set_style (mpl_set_style())
Method for setting the style for the plots, typically used here to load the PyRETIS style.
class pyretis.inout.plotting.mpl_plotting.MplPlotter(out_fmt, backup=False, style=None, out_dir=None)[source]

Bases: pyretis.inout.plotting.plotting.Plotter

A plotter using matplotlib.

This class defines a plotter which make use of matplotlib and it can be used as a starting point to create other plotters for PyRETIS bases on other tools (e.g. gnuplot etc.).


string – Defines what style to use for the plotting.


string – Selects format for output plots.

output_energy(results, energies)[source]

Plot energy results using mpl_plot_energy().

The parameters for this method is described in mpl_plot_energy().

Returns:out – This dict contains the files created by the plotting.
Return type:dict

Plot flux results using py:func:.mpl_plot_flux.

The parameters for this method is described in mpl_plot_flux().

Returns:outputfile – A list containing the files created for the flux and for the error in the flux.
Return type:list of dicts


The returned list is used to plot the figures in pairs.

output_matched_probability(path_ensembles, detect, matched)[source]

Plot matched probabilities using mpl_plot_matched()

The parameters for this method is described in mpl_plot_matched().

Returns:out – This dict contains the files created by the plotting.
Return type:dict
output_orderp(results, orderdata)[source]

Plot order parameter data using mpl_plot_orderp().

The parameters for this method is described in mpl_plot_orderp().

Returns:out – This dict contains the files created by the plotting.
Return type:dict
output_path(results, path_ensemble)[source]

Plot path results using mpl_plot_path().

The parameters for this method is described in mpl_plot_path().

Returns:out – This dict contains the files created by the plotting.
Return type:dict

pyretis.inout.plotting.plotting module

Definition of the base class for the plotter.

This module just defines a base class for plotters. This is just to ensure that all plotters at least implements some functions and that we can make use of them.

Important classes defined here

Plotter (Plotter)
A generic class for creating plots.
class pyretis.inout.plotting.plotting.Plotter(backup=True, plotter_type=None, out_dir=None)[source]

Bases: object

Base class for PyRETIS plotters.

This class defines a plotter. A plotter is just a object that supports certain functions which can be called by analysis output functions. It should define certain plots and the Plotter class is an abstract class just to make sure that all plotters define the needed plots.


boolean – Determines if we overwrite old files or try to back them up.


string – Defines a name for the plotter, in case we want to identify it.


string, optional – Defines an output directory for the plotter.


Just print out the basic info.

output_energy(results, energies)[source]

Function that plots energy results.


Function that plots flux results.

output_matched_probability(path_ensembles, detect, matched)[source]

Function that plots the overall probability for path ensembles.

output_orderp(results, orderdata)[source]

Function that plots order parameter results.

output_path(results, path_ensemble)[source]

Function that plots path ensemble results.