Basic Usage
Pass a list of numbers and Histogram divides them into 10 equal-width bins by default. Each bar represents a range, and its height shows how many values fall within that range. The shape of the resulting chart immediately reveals the distribution: a tall cluster on the left with a long tail to the right suggests most values are fast, but some outliers are significantly slower.Custom Bin Count
Setbins to control how many equal-width buckets the data is split into. Fewer bins give a coarser, smoother view of the distribution that emphasizes the overall shape. More bins reveal finer detail — individual peaks and valleys — but can make the chart noisy if your dataset is small. A good rule of thumb: start with the default 10 and adjust based on what story the data is telling.
Explicit Bin Edges
When you need precise control over where bins start and end, passbin_edges instead. The list defines the boundaries between bins — three edges produce two bins, four edges produce three, and so on. Values outside the edge range are excluded.
This is useful when your domain has meaningful thresholds. For API response times, you might define bins around SLA boundaries: “under 100ms” (fast), “100-200ms” (acceptable), “200-300ms” (slow), and “over 300ms” (investigate). The unequal bin widths tell a story that equal-width bins would miss.
Styled
Customize the bar color with any CSS color string and adjust the chart height. Thecolor parameter applies to all bars uniformly — since histograms represent a single variable’s distribution, one color is the norm.
API Reference
Histogram Parameters
Raw numeric values to bin.
Number of equal-width bins. Ignored when
bin_edges is set.Explicit bin boundaries. Overrides
bins when provided.Bar fill color as a CSS color string.
Chart height in pixels.
Corner radius of each bar in pixels.
Show tooltips on hover.
Show a legend below the chart.
Show horizontal grid lines.
Additional Tailwind CSS classes.
Protocol Reference
Histogram