web-client-ui
web-client-ui copied to clipboard
Histogram ignores `xmax` if `xmax` is greater than the largest `x` value being plotted
Description
Histograms created with plot_xy_hist do not extend their x-axis to xmax if this value is larger than the maximum x value present in the dataset.
Steps to reproduce
Run this code:
from deephaven.plot.figure import Figure
from deephaven import new_table
from deephaven.column import int_col
source = new_table([
int_col("Values", [1, 2, 2, 3, 3, 3, 4, 4, 5])
])
new_plot = Figure()\
.plot_xy_hist(series_name="Histogram Values", t=source, x="Values", nbins=5, xmin=0.0, xmax=10.0)\
.chart_title(title="Histogram of Values")\
.show()
Expected results
I expect this histogram to have data between 1 and 5, and an x-axis that extends out to 10.
Actual results
The axis stops at 6. It seems to want to obey nbins, and is binning the data as though the plot extends out to 10, but only non-zero bins are being shown, so there are fewer nbins than requested.
Versions
- Deephaven: 0.30.1
- OS: MacOS
- Browser: Safari
I think the API may be confusing - this is a maximum x value, not the maximum x range to show in the rendered plot.
Even the example in the docs shows an example with nbins=5 and only 3 bins show up: https://deephaven.io/core/docs/how-to-guides/plotting/histogram/#from-a-table
I think the API may be confusing - this is a maximum x value, not the maximum x range to show in the rendered plot. Even the example in the docs shows an example with
nbins=5and only 3 bins show up: https://deephaven.io/core/docs/how-to-guides/plotting/histogram/#from-a-table
Yep, I'd say that is a confusing API and not what I expected / wanted. Not sure what the resolution here should be.
