openpathsampling.numerics.HistogramPlotter2D
- class openpathsampling.numerics.HistogramPlotter2D(histogram, normed=True, xticklabels=None, yticklabels=None, xlim=None, ylim=None, label_format='{:}')[source]
Convenience tool for plotting 2D histograms and plotting data atop them.
The difficulty is that matplotlib uses the row/column numbers of a pandas.DataFrame as the actual internal axis. This class carries all the information to properly plot things (even mapping to CVs, if the histogram supports that).
The descriptions below will discuss “real space,” “bin space,” and “frame space.” Real space refers to the actual values of the input data. Bin space refers to the bins that come out of that for histogramming (made into continuous parameters). Frame space is bin space shifted such that the lowest bin values are 0.
- Parameters:
histogram (
SparseHistogram
) – input histogram to plotnormed (bool) – whether to normalize the histogram (using raw_probability=True)
xticklabels (list of float) – the desired locations for plot xticks, in real space
yticklabels (list of float) – the desired locations for plot yticks, in real space
xlim (2-tuple of (float, float)) – horizontal (x-value) range of (minimum, maximum) bounds for displaying the plot
ylim (2-tuple of (float, float)) – vertical (y-value) range of (minimum, maximum) bounds for displaying the plot
label_format (string) – Python format-style string for formatting tick labels. Default is ‘{:}’.
- __init__(histogram, normed=True, xticklabels=None, yticklabels=None, xlim=None, ylim=None, label_format='{:}')[source]
Methods
__init__
(histogram[, normed, xticklabels, ...])axes_setup
(xticklabels, yticklabels, xlim, ylim)Set up both x-axis and y-axis for plotting.
axis_input
(hist, ticklabels, lims, dof)Get ticks, range, and limits for a given DOF
plot
([normed, xticklabels, yticklabels, ...])Plot the histogram.
plot_trajectory
(trajectory, *args, **kwargs)Plot a trajectory (or CV trajectory) on the axes.
ticks_and_labels
(ticks, ax, dof)Obtain the plot ticks and tick labels for given dof.
to_bins
(alist, dof)Convert real-space values to bin-space values for a given dof