simuran.plot.base_plot module

This module provides functions to interface with matplotlib.

simuran.plot.base_plot.despine()

Despine the current plot with trimming.

simuran.plot.base_plot.get_plot_location(save_location, out_format)
simuran.plot.base_plot.save_simuran_plot(fig, save_location, **kwargs)

Save a figure using some default settings.

By default saves both a raster image (bitmap e.g. PNG, JPG) and a vector image (e.g. PDF, SVG). This can be disabled by setting format to None for the raster and vector_format to none for the vector

Parameters:
  • fig (matplotlib.figure.Figure) – The figure to save
  • save_location (str) – Where to save the figure to
Keyword Arguments:
 
  • dpi (int) – The dots per inch of the output, by default 400
  • bbox_inches (str or val) – The size of the bounding box, by default “tight”
  • pad_inches (str or val) – The size of the padding, by default 0.1
  • verbose (bool) – Whether to print more information, by default False
  • out_format (str) – The format to save the output to, by default None, which just uses the extension that is on save_location
Returns:

The locations saved to

Return type:

str

simuran.plot.base_plot.set_plot_style(palette='dark')

Set the seaborn palette and style.

simuran.plot.base_plot.setup_ax(ax=None, default={}, **kwargs) → matplotlib.axes.Axes

Set up an axis object with default parameters that can be overridden.

In this way, a function can set default for the usual things that should be plotted (e.g. plot axis labels), but keyword arguments can overwrite any of these.

Parameters:
  • ax (matplotlib.axes.Axes) – The axis object to set up.
  • default (dict) – Parameters to use for setting up the axis if not overridden. Can contain any of the keys that can be keyword arguments
Keyword Arguments:
 
  • xlabel (str) – What to label the x-axis
  • ylabel (str) – What to label the y-axis with
  • xticks (array like) – x ticks
  • xticklabels (array like) – Labels for the x- ticks
  • yticks (array like) – y ticks
  • yticklabels (array like) – Labels for the y- ticks
  • xrotate (float) – The amount to rotate the x labels by
  • yrotate (float) – The amount to rotate the y labels by
  • labelsize (float) – The text size of the labels
Returns:

Return type:

ax