lampe.plots#

Plotting helpers.

Functions#

nice_rc

Returns a dictionary of runtime configuration (rc) settings for nicer matplotlib plots.

corner

Displays each 1 or 2-d projection of multi-dimensional data, as a triangular matrix of histograms, known as corner plot.

mark_point

Marks a point on the histograms of a corner plot.

coverage_plot

Plots the expected coverage at various credible levels.

Descriptions#

lampe.plots.nice_rc(latex=False)#

Returns a dictionary of runtime configuration (rc) settings for nicer matplotlib plots. The settings include 12pt font size, higher DPI, tight layout, transparent background, etc.

Parameters

latex (bool) – Whether to use LaTeX typesetting or not.

Example

>>> plt.rcParams.update(nice_rc())
lampe.plots.corner(data, weights=None, domain=None, bins=64, creds=(0.6827, 0.9545, 0.9973), color=None, alpha=(0.0, 0.5), legend=None, labels=None, smooth=0, figure=None, **kwargs)#

Displays each 1 or 2-d projection of multi-dimensional data, as a triangular matrix of histograms, known as corner plot. For 2-d histograms, highest density credibility regions are delimited.

Parameters
Returns

The figure instance for the corner plot.

Return type

Figure

Example

>>> data = np.random.randn(2**16, 3)
>>> labels = [r'$\alpha$', r'$\beta$', r'$\gamma$']
>>> figure = corner(data, bins=32, labels=labels, figsize=(4.8, 4.8))
../_images/corner.png
lampe.plots.mark_point(figure, point, color='black', linestyle='dashed', marker='s', legend=None)#

Marks a point on the histograms of a corner plot.

Parameters
  • figure (Figure) – The corner plot figure (see corner).

  • point (ndarray) – The point to mark.

  • color (Union[str, tuple]) – The color of the lines and markers.

  • linestyle (str) – The style of the lines.

  • marker (str) – The shape of the markers.

  • legend (Optional[str]) – A legend.

Example

>>> mark_point(figure, [0.5, 0.3, -0.7], color='black')
../_images/corner_marked.png
lampe.plots.coverage_plot(levels, coverages, color=None, legend=None, figure=None, **kwargs)#

Plots the expected coverage at various credible levels.

Parameters
Returns

The figure instance for the coverage plot.

Return type

Figure

Example

>>> levels = np.linspace(0, 1, 512) ** 2
>>> coverages = np.linspace(0, 1, 512)
>>> figure = coverage_plot(levels, coverages)
../_images/coverage.png