From ba4ccc097073d9c3da12089feddbef4739d93280 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Fri, 8 Nov 2024 13:21:59 -0600 Subject: [PATCH] wip --- plugins/plotly-express/docs/histogram.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/plotly-express/docs/histogram.md b/plugins/plotly-express/docs/histogram.md index 83f60eb18..e44ab40d5 100644 --- a/plugins/plotly-express/docs/histogram.md +++ b/plugins/plotly-express/docs/histogram.md @@ -47,6 +47,27 @@ hist_3_bins = dx.histogram(setosa, x="SepalLength", nbins=3) hist_8_bins = dx.histogram(setosa, x="SepalLength", nbins=8) ``` +### Bin and aggregate on different columns + +If both `x` and `y` are specified, the histogram will be binned across one column and aggregated on the other. + +```python order=hist_v,hist_h,hist_avg,iris +import deephaven.plot.express as dx +iris = dx.data.iris() + +# subset to get specific species +setosa = iris.where("Species == `setosa`") + +# The default orientation is "v" (vertical) and the default aggregation function is "sum" +hist_v = dx.histogram(setosa, x="SepalLength", y="SepalWidth") + +# Control the plot orientation using orientation +hist_h = dx.histogram(setosa, x="SepalLength", y="SepalWidth", orientation="h") + +# Control the aggregation function using histfunc +hist_avg = dx.histogram(setosa, x="SepalLength", y="SepalWidth", histfunc="avg") +``` + ### Distributions of several groups Histograms can also be used to compare the distributional properties of different groups of data, though they may be a little harder to read than [box plots](box.md) or [violin plots](violin.md). Pass the name of the grouping column(s) to the `by` argument.