Scotchcorner

Documentation for the corner plotting module scotchcorner.

https://zenodo.org/badge/48458682.svg

Contents:

class scotchcorner.Bounded_2d_kde(pts, xlow=None, xhigh=None, ylow=None, yhigh=None, *args, **kwargs)

Represents a two-dimensional Gaussian kernel density estimator for a probability distribution function that exists on a bounded domain (by Ben Farr).

evaluate(pts)

Return an estimate of the density evaluated at the given points.

xhigh

The upper bound of the x domain.

xlow

The lower bound of the x domain.

yhigh

The upper bound of the y domain.

ylow

The lower bound of the y domain.

class scotchcorner.scotchcorner(data, bins=20, ratio=3, labels=None, truths=None, datatitle=None, showlims=None, limlinestyle='dotted', showpoints=True, showcontours=False, hist_kwargs={}, truths_kwargs={}, scatter_kwargs={}, contour_kwargs={}, contour_levels=[0.5, 0.9], show_level_labels=True, use_math_text=True, limits=None, contour_limits=None, figsize=None, mplparams=None, thinpoints=1.0, subtract_truths=None)

Create a corner-style plot.

data : numpy.ndarray or pandas.DataFrame
A (N x ndims) array of values for the ndims parameters
bins : int, optional, default: 20
The number of bins in the 1D histogram plots
ratio : int, optional, default: 3
The ratio of the size of 1D histograms to the size of the joint plots
labels : list, optional
A list of names for each of the ndims parameters. These are used for the axes labels. If data is a pandas.DataFrame then the column names of that will be used instead.
truths : list, optional, default: None
A list of the true values of each parameter
datatitle : string, optional
A title for the data set to be added as a legend
showlims : string, optional, default: None
Show edges/borders at the plots limits. Use ‘hist’ for limits on the 1D histogram plots, ‘joint’ for borders around 2D joint plots, or ‘both’ for borders on the 1D and 2D plots. The default (None) is for no borders.
limlinestyle : default: ‘dotted’
The line style for the plot borders
hist_kwargs : dict
A dictionary of keywords arguments for the histogram function
truth_kwargs : dict
A dictionary of keyword arguments for plotting true values
showpoints: bool, default: True
Show the data points in the 2D joint parameter plots
thinpoints : float, default: 1.0
Thin-down the number of points being plotted in the 2D scatter plots by this factor
scatter_kwargs : dict
A dictionary of keyword arguments for the scatter plot function
showcontours : bool, default: False
Show KDE probability contours for the 2D joint parameter plots (with levels defined by contour_levels)
contour_kwargs : dict
A dictionary of keyword argumemts for the contour plot function
contour_levels : list, default: [0.5, 0.9]
A list of values between 0 and 1 indicating the probability contour confidence intervals to plot (defaulting to 50% and 90% contours)
show_level_labels : bool, default: True
Add labels on the contours levels showing their probability
use_math_text : bool, default: True
Use math text scientific notation for parameter tick mark labelling
limits : list, default: None
A list of tuples giving the lower and upper limits for each parameter. If limits for some parameters are not known/required then an empty tuple (or None within a two value tuple) must be placed in the list for that parameter
contour_limits : list, default: None
A list of tuples giving the lower and upper limits for each parameter for use when creating credible interval contour for joint plots. If limits for some parameters are not known/required then an empty tuple (or None within a two value tuple) must be placed in the list for that parameter
subtract_truths : list or tuple, optional, default: None
A list/tuple of indices of parameters for which you want to show the distribution centred such that true value is zero. This is only relevent if truths are supplied.
figsize : tuple
A two value tuple giving the figure size
mplparams : dict
A dictionary containing matplotlib configuration values
add_data(data, hist_kwargs={}, datatitle=None, showpoints=True, showcontours=False, scatter_kwargs={}, contour_kwargs={}, truths=None, truths_kwargs={}, contour_levels=[0.5, 0.9], limits=None, contour_limits=None, show_level_labels=True, thinpoints=1.0)

Add another data set to the plots, hist_kwargs are required.

fig

Return the matplotlib.figure.Figure

format_exponents_in_label_single_ax(ax)

Routine for a single axes instance (by Greg Ashton)

get_axis(param)

Return the axis for the given “param” (for joint axes “param” should be the required parameters separated by “vs”)

plot_bounded_2d_kde_contours(ax, pts, xlow=None, xhigh=None, ylow=None, yhigh=None, transform=None, gridsize=250, clip=None)

Function (based on that in plotutils by Will Farr and edited by Ben Farr) for plotting contours from a bounded 2d KDE.

savefig(filename)

Save the figure

filename : str, required
The filename of the figure to save. The figure format is determined by the file extension.
show()

Show the figure

update_label(old_label, exponent_text)

Method to transform given label into the new label (this function comes from this patch to corner.py by Greg Ashton)

Indices and tables