pyrolite.plot.density.ternary
- pyrolite.plot.density.ternary.ternary_heatmap(data, bins=20, mode='density', transform=<function ILR>, inverse_transform=<function inverse_ILR>, ternary_min_value=0.0001, grid_border_frac=0.1, grid=None, **kwargs)[source]
Heatmap for ternary diagrams. This invokes a 3D to 2D transform such as a log transform prior to creating a grid.
- Parameters
data (
numpy.ndarray
) – Ternary data to obtain heatmap coords from.bins (
int
) – Number of bins for the grid.mode (
str
,{'histogram', 'density'}
) – Which mode to render the histogram/KDE in.transform (
callable
|sklearn.base.TransformerMixin
) – Callable function or Transformer class.inverse_transform (
callable
) – Inverse function for transform, necessary if transformer class not specified.ternary_min_value (
float
) – Optional specification of minimum values within a ternary diagram to draw the transformed grid.grid_border_frac (
float
) – Size of border around the grid, expressed as a fraction of the total grid range.grid (
numpy.ndarray
) – Grid coordinates to sample at, if already calculated. For the density mode, this is a (nsamples, 2) array. For histograms, this is a two-member list of bin edges.- Returns
t, l, r (
tuple
ofnumpy.ndarray
) – Ternary coordinates for the heatmap.H (
numpy.ndarray
) – Histogram/density estimates for the coordinates.data (
dict
) – Data dictonary with grid arrays and relevant information.Notes
Zeros will not render in this heatmap, consider replacing zeros with small values or imputing them if they must be incorporated.