Black Lives Matter. Please consider donating to Black Girls Code today.

Grouped bar charts don't show with more than two traces


I have a bar chart where I want to show several data points next to each other. However, if I have more than two traces in the data, none of the bars show up. If I hide one using the legend it works fine. It doesn’t seem to matter whether or not it is a date on x.

Here is a codepen showing the issue.


Hi @mad, the problem comes from the fact that plotly.js is trying to interpret your xaxis as numerical values. Forcing the axis type to be 'category' fixes the problem, see

var layout = {
  xaxis: {'type':'category'}
Plotly.newPlot('myDiv', data, layout);