plot

Functions for plotting data.

The functions in this module are simple wrappers around plotting functions of matplotlib.

This module is not directly accessible from mdtools, but must be loaded explicitly e.g. via:

import mdtools.plot as mdtplt

This module loads the custom matplotlib style sheet src/mdtools/pkg_data/mdtools.mplstyle. If you want to keep the default plotting style, you have to re-load the default style after importing mdtools.plot:

import matplotlib.pyplot as plt
plt.style.use("default")

See Customizing Matplotlib with style sheets and rcParams for more information about style sheets. Among other settings, mdtools.mplstyle sets the default figure size to 8.26772 x 5.82677 inches, which is the size of a DIN A5 paper in landscape format. The default font size is set to 24 points and also the line widths and marker sizes are scaled appropriately. In this way the produced figures can be used for presentations and posters or they can be scaled down to the width of a single text column in a scientific journal without loosing readability.

With the introduction of the mdtools.mplstyle style sheet during preparation of version 0.0.1.0, a lot of functions in this module became deprecated, because the functions were just wrappers around corresponding matplotlib functions with hardcoded style settings. With the style sheet, the matplotlib functions can be called directly and create plots with the desired style.

Todo

  • Update deprecated plot functions in the plot scripts.

  • Remove the deprecated plot functions in this module.

Functions

annotate_heatmap

Annotate a heatmap.

correlogram

Create a correlogram and plot it to the given matplotlib.axes.Axes.

errorbar

Plot data to a matplotlib.axes.Axes object with errorbars using matplotlib.axes.Axes.errorbar().

fill_between

Fill the area between two curves y1 and y2 using matplotlib.axes.Axes.fill_between().

fill_betweenx

Fill the area between two vertical curves x1 and x2 using matplotlib.axes.Axes.fill_betweenx().

hist

Plot a histogram to a matplotlib.axes.Axes object using matplotlib.axes.Axes.hist().

hlines

Plot horizontal lines at each y from start to stop into a matplotlib.axes.Axes object using matplotlib.axes.Axes.hlines().

imshow

Plot two dimensional data as heatmap with matplotlib.axes.Axes.imshow().

imshow_new

Plot two dimensional data as colormap with matplotlib.axes.Axes.imshow().

matshow

Plot a two dimensional matrix as heatmap with matplotlib.axes.Axes.matshow().

matshow_new

Plot two dimensional data as colormap with matplotlib.axes.Axes.matshow().

pcolormesh

Plot two dimensional data as heatmap with matplotlib.axes.Axes.pcolormesh().

pcolormesh_new

Plot two dimensional data as colormap with matplotlib.axes.Axes.pcolormesh().

plot

Plot data to a matplotlib.axes.Axes object using matplotlib.axes.Axes.plot().

plot_2nd_xaxis

Plot data to a second x-axis.

plot_2nd_yaxis

Plot data to a second y-axis.

scatter

Add a scatter plot to a matplotlib.axes.Axes object using matplotlib.axes.Axes.scatter().

sci_notation_tex

Convert a number to scientific notation in TeX format.

vlines

Plot vertical lines at each x from start to stop into a matplotlib.axes.Axes object using matplotlib.axes.Axes.vlines().

Classes

MidpointNormalize

Class to define your own colorbar normalization.