Skip to content
Advertisement

How to show data by day in a Plotly chart

I have a dataframe with the number of people vaccinated per day and I’m trying to put this data in a daily bar chart of Plotly, but it aggregates the data every about 13 days. I don’t want the aggregated view this way, I need it to show the bars per day.

Below is a part of the dataframe and the code.

enter image description here

JavaScript

Graphic

Advertisement

Answer

Solution 1

You can manually set the width of the bins:

JavaScript

Solution 2

You can pass a parameter called nbins. If you set nbins to the number of days, you’ll get one bar per day. You could try

JavaScript

See #Choosing the number of bins for reference.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement