getdist.plots.GetDistPlotter

class getdist.plots.GetDistPlotter(chain_dir: str | Iterable[str] | None = None, settings: GetDistPlotSettings | None = None, analysis_settings: str | dict | IniFile = None, auto_close=False)[source]

Main class for making plots from one or more sets of samples.

Variables:
  • settings – a GetDistPlotSettings instance with settings

  • subplots – a 2D array of Axes for subplots

  • sample_analyser – a MCSampleAnalysis instance for getting MCSamples and derived data from a given root name tag (e.g. sample_analyser.samples_for_root(‘rootname’))

Parameters:
  • chain_dir – Set this to a directory or grid directory hierarchy to search for chains (can also be a list of such, searched in order)

  • analysis_settings – The settings to be used by MCSampleAnalysis when analysing samples

  • auto_close – whether to automatically close the figure whenever a new plot made or this instance released

__init__(chain_dir: str | Iterable[str] | None = None, settings: GetDistPlotSettings | None = None, analysis_settings: str | dict | IniFile = None, auto_close=False)[source]
Parameters:
  • chain_dir – Set this to a directory or grid directory hierarchy to search for chains (can also be a list of such, searched in order)

  • analysis_settings – The settings to be used by MCSampleAnalysis when analysing samples

  • auto_close – whether to automatically close the figure whenever a new plot made or this instance released

Methods

__init__([chain_dir, settings, ...])

param chain_dir:

Set this to a directory or grid directory hierarchy to search for chains

add_1d(root, param[, plotno, normalized, ...])

Low-level function to add a 1D marginalized density line to a plot

add_2d_contours(root[, param1, param2, ...])

Low-level function to add 2D contours to plot for samples with given root name and parameters

add_2d_covariance(means, cov[, xvals, ...])

Plot 2D Gaussian ellipse.

add_2d_density_contours(density, **kwargs)

Low-level function to add 2D contours to a plot using provided density

add_2d_mixture_projection(mixture, param1, ...)

add_2d_scatter(root, x, y[, color, alpha, ...])

Low-level function to add a 2D sample scatter plot to the current axes (or ax if specified).

add_2d_shading(root, param1, param2[, ...])

Low-level function to add 2D density shading to the given plot.

add_3d_scatter(root, params[, color_bar, ...])

Low-level function to add a 3D scatter plot to the current axes (or ax if specified).

add_4d_scatter(root, params, ax[, ...])

add_bands(x, y, errors[, color, nbands, ...])

Add a constraint band as a function of x showing e.g. a 1 and 2 sigma range.

add_colorbar(param[, orientation, mappable, ...])

Adds a color bar to the given plot.

add_colorbar_label(cb, param[, label_rotation])

Adds a color bar label.

add_legend(legend_labels[, legend_loc, ...])

Add a legend to the axes or figure.

add_line(xdata, ydata[, zorder, color, ls, ax])

Adds a line to the given axes, using Line2D

add_param_markers(param_value_dict, *[, ...])

Adds vertical and horizontal lines on all subplots marking some parameter values.

add_text(text_label[, x, y, ax])

Add text to given axis.

add_text_left(text_label[, x, y, ax])

Add text to the left, Wraps add_text.

add_x_bands(x, sigma[, color, ax, alpha1, ...])

Adds vertical shaded bands showing one and two sigma ranges.

add_x_marker(marker[, color, ls, lw, ax])

Adds vertical lines marking x values.

add_y_bands(y, sigma[, color, ax, alpha1, ...])

Adds horizontal shaded bands showing one and two sigma ranges.

add_y_marker(marker[, color, ls, lw, ax])

Adds horizontal lines marking y values.

default_col_row([nplot, nx, ny])

Get default subplot columns and rows depending on number of subplots.

export([fname, adir, watermark, tag])

Exports given figure to a file.

finish_plot([legend_labels, legend_loc, ...])

Finish the current plot, adjusting subplot spacing and adding legend if required.

get_axes([ax, pars])

Get the axes instance corresponding to the given subplot (y,x) coordinates, parameter list, or otherwise if ax is None get the last subplot axes used, or generate the first (possibly only) subplot if none.

get_axes_for_params(*pars, **kwargs)

Get axes corresponding to given parameters

get_param_array(root[, params, renames])

Gets an array of ParamInfo for named params in the given root.

get_single_plotter([scaling, rc_sizes])

get_subplot_plotter([subplot_size, ...])

make_figure([nplot, nx, ny, xstretch, ...])

Makes a new figure with one or more subplots.

new_plot([close_existing])

Resets the given plotter to make a new empty plot.

param_bounds_for_root(root)

Get any hard prior bounds for the parameters with root file name

param_latex_label(root, name[, label_params])

Returns the latex label for given parameter.

param_names_for_root(root)

Get the parameter names and labels ParamNames instance for the given root name

plot_1d(roots, param[, marker, ...])

Make a single 1D plot with marginalized density lines.

plot_2d(roots[, param1, param2, param_pair, ...])

Create a single 2D line, contour or filled plot.

plot_2d_scatter(roots, param1, param2[, ...])

Make a 2D sample scatter plot.

plot_3d(roots[, params, params_for_plots, ...])

Make a 2D scatter plot colored by the value of a third parameter (a 3D plot).

plot_4d(roots, params[, color_bar, ...])

Make a 3d x-y-z scatter plot colored by the value of a fourth parameter.

plots_1d(roots[, params, legend_labels, ...])

Make an array of 1D marginalized density subplots

plots_2d(roots[, param1, params2, ...])

Make an array of 2D line, filled or contour plots.

plots_2d_triplets(root_params_triplets[, ...])

Creates an array of 2D plots, where each plot uses different samples, x and y parameters

plots_3d(roots, param_sets[, nx, legend_labels])

Create multiple 3D subplots

plots_3d_z(roots, param_x, param_y[, ...])

Make set of sample scatter subplots of param_x against param_y, each coloured by values of parameters in param_z (all if None).

rectangle_plot(xparams, yparams[, yroots, ...])

Make a grid of 2D plots.

rotate_xticklabels([ax, rotation, labelsize])

Rotates the x-tick labels by given rotation (degrees)

rotate_yticklabels([ax, rotation, labelsize])

Rotates the y-tick labels by given rotation (degrees)

samples_for_root(root[, file_root, cache, ...])

Gets MCSamples from root name (or just return root if it is already an MCSamples instance).

set_axes([params, lims, do_xlabel, ...])

Set the axis labels and ticks, and various styles.

set_default_settings()

set_xlabel(param[, ax])

Sets the label for the x-axis.

set_ylabel(param[, ax])

Sets the label for the y-axis.

set_zlabel(param[, ax])

Sets the label for the z axis.

show_all_settings()

Prints settings and library versions

triangle_plot(roots[, params, ...])

Make a trianglular array of 1D and 2D plots.