With the following code I get 15 bins instead of 20 as expected.
import pandas as pd
from plotly.offline import plot
from plotly.graph_objs import Histogram
df = pd.read_csv('https://raw.githubusercontent.com/AntoineGautier/Data/master/tmp.txt')
I also noticed this. Did you manage to find a solution?
nbinx specifies the maximum number of desired bins not the exact number of bins to show. WIth
nbinx set, plotly still attempts to round the number of bins to nice numbers. See the full attribute reference here for more info.
To set the exact number of bins, you’ll need to use a combination of
I tried to set the xbins.start, end, size, but no working. Do you have an example?
This finally worked for me:
fig = go.Figure()
fig.add_trace(go.Histogram(x=penetration.p_member, name=‘population’, histnorm=‘percent’,
fig.add_trace(go.Histogram(x=df_test88.toPandas().p_member, name=‘sample_88’, histnorm=‘percent’,
Reduce opacity to see both histograms
Does anybody know more about how the algorithm finds the optimal bin sizes? I have a multi plot which I want to standardize the y-axis ranges to, which means that I need to be able to count the number of data within a bin.