cogwheel.plotting.PlotStyle

class cogwheel.plotting.PlotStyle(confidence_level: float = 0.9, contour_fractions: tuple[float] = (0.5, 0.9), bins: int | str = 'rice', color_2d: str = 'k', contour_kwargs: dict = <factory>, vline_kwargs: dict = <factory>, vfill_kwargs: dict = <factory>, kwargs_1d: dict = <factory>, clabel_kwargs: dict = None, fill: str = 'gradient', smooth: float = 0.0, density: bool = True, tail_probability: float = 0.0)

Bases: object

Class that encapsulates plotting choices (colors, linestyles, etc.) for a corner plot of a distribution.

Attributes:
confidence_levelfloat between 0 and 1, or None

Determines the reported confidence interval around the median (highlighted band in 1-d marginal probability and numeric values in the subplot titles). If None, both the numerical values and highlighted bands are removed.

contour_fractionssequence of floats

Fractions of the distribution to enclose by 2-d contours.

binsint | {‘rice’, ‘sturges’, ‘sqrt’}

How many histogram bins to use, the same for all parameters.

color_2dstr, RGB tuple, etc.

Color used for the 2-d marginal distributions.

contour_kwargsdict

Keyword arguments to plt.contour and plt.contourf

vline_kwargsdict

Keyword arguments to plt.plot for the vertical lines signaling medians and 1-d confidence intervals.

vfill_kwargsdict

Keyword arguments to plt.fill_between for 1-d plots.

kwargs_1ddict

Keyword arguments to plt.plot for 1-d plots.

clabel_kwargsdict, optional

Keyword arguments for contour labels. Pass an empty dict to use defaults. None draws no contour labels.

fill{‘gradient’, ‘flat’, ‘none’}

How to display 2-d marginal distributions:

  • ‘gradient’ displays the 2-d pdf with a transparency gradient

  • ‘flat’ fills the contours with a flat transparent color

  • ‘none’ shows just the contours

smoothfloat

Smooth the 2d histograms by convolving them with a Gaussian kernel with this standard deviation in pixel units. 0 (default) does no smoothing.

densitybool

Whether to normalize the 1-d histograms to integrate to 1.

tail_probabilityfloat between 0 and 1

Disregard tail_probability / 2 of the distribution to either side in the plots. Used as an automatic way of zooming in on the interesting part of the distribution if there are a few outlier samples. 0 (default) includes all samples.

Methods

get_contour_kwargs

Keyword arguments to plt.contour.

get_contourf_kwargs

Keyword arguments to plt.contourf.

get_many

Return list of plostyles with different colors and linestyles.

get_vfill_kwargs

Keyword arguments to plt.fill_between for 1-d plots.

get_vline_kwargs

Keyword arguments to plt.plot for the vertical lines signaling medians and 1-d confidence intervals.

Attributes

KWARGS_1D

VFILL_KWARGS

VLINE_KWARGS

bins

clabel_kwargs

color_2d

confidence_level

contour_fractions

decreasing_contour_fractions

In decreasing order so that levels are increasing.

density

fill

smooth

tail_probability

contour_kwargs

vline_kwargs

vfill_kwargs

kwargs_1d

property decreasing_contour_fractions

In decreasing order so that levels are increasing.

get_contour_kwargs()

Keyword arguments to plt.contour.

get_contourf_kwargs()

Keyword arguments to plt.contourf.

classmethod get_many(number, **kwargs)

Return list of plostyles with different colors and linestyles.

get_vfill_kwargs()

Keyword arguments to plt.fill_between for 1-d plots.

get_vline_kwargs()

Keyword arguments to plt.plot for the vertical lines signaling medians and 1-d confidence intervals.