Type Alias: HistogramTrace
ts
type HistogramTrace = CommonTraceAttributes & CartesianTraceAttributes & object;Histogram: samples binned into bars (counts, sums, averages…), vertical or horizontal, stacking and grouping with bars.
Type Declaration
| Name | Type | Description |
|---|---|---|
alignmentgroup? | string | Traces on the same position axis with the same alignment group split each position between their offset groups; different alignment groups lay out independently. |
autobinx? | boolean | Obsolete (every bin attribute is automatic unless set): true ignores xbins and bins automatically. |
autobiny? | boolean | Obsolete: true ignores ybins and bins automatically. |
bingroup? | string | Histograms (and 2D histograms) with the same bin group share their bins, also across subplots on axes of one type. Under barmode stack or group, the histograms of a subplot and orientation always share bins. |
cliponaxis? | boolean | Clip labels to the plot area. false is not drawn yet: labels are always clipped to the subplot. |
constraintext? | "inside" | "outside" | "both" | "none" | Shrink labels (inside, outside, or both) so they are no larger than their bar. |
cumulative? | HistogramTraceCumulative | Cumulative histograms. |
error_x? | BarTraceErrorX | Error bars along the x axis. |
error_y? | BarTraceErrorY | Error bars along the y axis. |
histfunc? | "count" | "sum" | "avg" | "min" | "max" | What each bar shows: the number of samples in the bin (count), or the sum, average (avg), min or max of the other coordinate (y for vertical histograms) over the bin. Needs both coordinates for anything but count. |
histnorm? | "" | "percent" | "probability" | "density" | "probability density" | Normalization: '' the raw values; percent / probability the share of the total (bar heights sum to 100 / 1); density the value per unit of bin width (bar areas sum to the total; per ms on date axes); probability density the share per unit width (bar areas sum to 1). |
insidetextanchor? | "end" | "middle" | "start" | Where inside labels sit along the bar. |
insidetextfont? | BarTraceInsidetextfont | Font of labels inside bars. Defaults to textfont, with a color contrasting the bar fill. |
marker? | BarTraceMarker | Bar style. |
nbinsx? | number | Maximum number of bins along x: the bin size is the next round size giving at most this many. 0: automatic. Ignored when xbins.size is set. Minimum: 0 |
nbinsy? | number | Maximum number of bins along y (horizontal histograms), see nbinsx. Ignored when ybins.size is set. Minimum: 0 |
offsetgroup? | string | Traces with the same offset group share one slot in group mode (and stack together in stack/relative modes); bars at the same position line up, also across subplots on the same position axis. |
orientation? | "v" | "h" | 'v': bin x into vertical bars; 'h': bin y into horizontal bars. Defaults to 'h' when only y is given. |
outsidetextfont? | BarTraceOutsidetextfont | Font of labels outside bars. Defaults to textfont. |
selected? | BarTraceSelected | Style of selected bars while a selection is active. |
text? | PerPoint<string | number> | Text per bar, drawn per textposition and shown in hover labels. |
textangle? | number | "auto" | Label rotation in degrees, clockwise. 'auto' turns inside labels 90° when that fits the bar better. |
textfont? | BarTraceTextfont | Font of bar labels. Defaults to layout.font. |
textposition? | PerPoint<"inside" | "outside" | "auto" | "none"> | Where bar labels go: inside (against the bar end, see insidetextanchor), outside (past the bar end; inner bars of a stack stay inside), auto (inside when it fits, else outside), none. |
texttemplate? | PerPoint<string | number> | Template for bar labels, overriding text: %{value} (bar length), %{label} (position), %{x}, %{y}, %{text}, %{customdata}, %{meta}, with optional d3 formats (%{value:.1f}) or date formats (`%{x |
type | "histogram" | Trace type. |
unselected? | BarTraceUnselected | Style of unselected bars while a selection is active. |
x? | DataColumn | Samples binned along x (vertical bars when only x is given): numbers, dates or category names depending on the axis type. With both x and y, the coordinate across the bars is what histfunc aggregates. |
xbins? | HistogramTraceXbins | Bins along x. Unset parts are automatic; traces of one bingroup share them. |
y? | DataColumn | Samples binned along y (horizontal bars when only y is given): numbers, dates or category names depending on the axis type. With both x and y, the coordinate across the bars is what histfunc aggregates. |
ybins? | HistogramTraceYbins | Bins along y. Unset parts are automatic; traces of one bingroup share them. |
zorder? | number | Stacking order among the traces of a subplot: higher is drawn on top. At equal zorder, bars draw below scatter traces (Plotly’s layer order), then in trace order. |