Skip to content

Type Alias: Histogram2dTrace ​

ts
type Histogram2dTrace = CommonTraceAttributes & CartesianTraceAttributes & object;

2D histogram: samples binned along x and y, counted (or aggregated) per cell and drawn as a heatmap.

Type Declaration ​

NameTypeDescription
autobinx?booleanObsolete (Plotly compatibility): bins are automatic unless xbins sets them.
autobiny?booleanObsolete (Plotly compatibility): bins are automatic unless ybins sets them.
autocolorscale?booleanPick the colorscale from the sign of the color domain (layout.colorscale.sequential, sequentialminus or diverging) instead of colorscale.
bingroup?stringDefault of xbingroup and ybingroup (suffixed per direction): traces with the same bingroup get matching x bins and matching y bins.
coloraxis?"coloraxis" | `coloraxis${number}`Share a colorscale and domain with other traces through layout.coloraxis ('coloraxis', 'coloraxis2', …). Overrides this trace's colorscale attributes.
colorbar?ColorbarThe colorbar of this colorscale (plan E5.3).
colorscale?| ColorScale | readonly string[] | readonly readonly (number | string)[][]Colorscale of the aggregated values: a name ('Viridis', 'RdBu', …), a list of colors, or [position, color] stops from 0 to 1. Default: Plotly's RdBu; the default holochart template uses its sequential neon plasma.
histfunc?"count" | "sum" | "avg" | "min" | "max"What each bin shows: the number of samples (count), or the sum, average (avg), min or max of their z values.
histnorm?"" | "percent" | "probability" | "density" | "probability density"Normalization: none, the percentage or fraction of the total (percent, probability), per unit area (density: value / bin area), or both (probability density, integrating to 1).
marker?Histogram2dTraceMarkerAggregation data (Plotly compatibility).
nbinsx?numberMaximum number of x bins when xbins.size is not given (a nice round size is picked). 0: automatic. Minimum: 0
nbinsy?numberMaximum number of y bins when ybins.size is not given (a nice round size is picked). 0: automatic. Minimum: 0
reversescale?booleanReverse the colorscale (the lowest value gets the last color).
showscale?booleanShow a colorbar for the colorscale (drawn by the colorbar component).
textfont?Histogram2dTraceTextfontFont of the cell labels (texttemplate).
texttemplate?stringLabel drawn in every cell: %{z} (the bin value), %{x}, %{y} (bin centers), with optional d3 formats (%{z:.1f}). Empty: no labels.
type"histogram2d"Trace type.
x?DataColumnSample x coordinates (numbers, dates or categories), binned along x. Required, with y.
xbingroup?stringTraces (histogram2d, histogram2dcontour, and histograms with the same bingroup) on axes of the same type with the same group share their x bins.
xbins?Histogram2dTraceXbinsX binning.
xgap?numberHorizontal gap between cells, in px (only without zsmooth). Minimum: 0
xhoverformat?stringd3 number or date format of x values in hover labels. Default: the axis format.
y?DataColumnSample y coordinates (numbers, dates or categories), binned along y. Required, with x.
ybingroup?stringLike xbingroup, for y bins.
ybins?Histogram2dTraceYbinsY binning.
ygap?numberVertical gap between cells, in px (only without zsmooth). Minimum: 0
yhoverformat?stringd3 number or date format of y values in hover labels. Default: the axis format.
z?DataColumnValues aggregated by histfunc (one per sample); counts are used without.
zauto?booleanCompute the color domain from the aggregated values. Defaults to false when both zmin and zmax are given.
zhoverformat?stringd3 number format of z values in hover labels (and %{z} in templates).
zmax?numberValue mapped to the last colorscale color (with zmin; turns zauto off).
zmid?numberWith zauto, widen the automatic domain so it is symmetric around this value (diverging data).
zmin?numberValue mapped to the first colorscale color (with zmax; turns zauto off).
zorder?numberStacking order among the traces of a subplot: higher is drawn on top. At equal zorder, heatmap-like traces draw below bars and scatter traces (Plotly’s layer order).
zsmooth?"fast" | "best" | falseCell smoothing: none (false, flat cells), 'fast' (bilinear between cell centers, by cell index) or 'best' (bilinear between cell centers in data space, exact for uneven bins). Drawn on the GPU either way.

Released under the MIT License.