I have some data from a dataframe column that I am trying to put into a histogram in custom bin sizes, that are static - not dynamically generated based on the data.
The data are minutes. Here is an example (with index):
The bin sizes will always be: (0-15], (15-30], (30-45], (45-60], (60-75], 75+
I am having trouble finding how I can set up my histogram bins to categorize the data this way. I have read through all the documentation I can find, and the help pages and not quite finding what I need.
This is some of my code, but it still creates only 2 bins:
import plotly.graph_objects as go from plotly.subplots import make_subplots fig = make_subplots(rows=1, cols=2) trace0 = go.Histogram(x=df[col_name], xbins=dict( start=0, end=75, size=15), autobinx=False) trace1 = go.Histogram(x=df[col_name], nbinsx=6) fig.append_trace(trace0, 1, 1) fig.append_trace(trace1, 1, 2) fig.show()
I was looking at possibly setting up a frequency table and then using a bar chart off of that, but I like the overlay feature of the histograms so would like to stay in that part of the library if possible.