Duplicate labels on X Axis

I am creating a bar chart and some of the x axis labels are duplicated. The Plot.ly JS library seems to skip over the duplicate labels. As an example, assume my values are the following.

x: [“a”,“a”,“b”,“c”,“d”,“e”]
y: [1,1.5,.5,1,2,1];

The library is only showing 5 bars instead of 6 since “a” is duplicated. Is there a configuration option to fix this?

This came up before. See https://github.com/plotly/plotly.js/issues/1516 for some background info on the topic.

This easiest solution would be to set:

x: ["a"," a ","b","c","d","e"]
y: [1,1.5,.5,1,2,1];

How will you handle duplicate dates ? what if the x-axis is a timeline and you have to plot bars at a particular time. plotly currently ignore the duplicate dates and doesn’t draw bars at all. Any suggestion as to how to handle it ?

1 Like