Grouped bar chart leaves gap when a trace has missing element for a one or more xaxis tick

Hi,

I am trying to create a grouped bar chart. There are 5 data series. However, some of the traces don’t have any valid value for each of the xaxis tick. When a trace has not value for an xaxis-tick, plotly is leaving a gap in the bar chart for that trace. However, I don’t want it to leave the gap. For example if for xaxis time tick 3, there are only 4 traces that have value, and the 5th trace doesnt plotly should generate 4 bars with out any gap between them.

I have a simple plot to show what is happening:
https://jsfiddle.net/a951kkLo/

For xaxis ticks 2 and 7 i dont want gaps. How can I do it?

Thanks for writing in.

As you described, plotly.js makes sure that each bar of a given trace is plotted from the same offset with respect to their x values - leaving to gaps at the location of bars with blanks values.

So, if I understand correctly, you want to show only 4 bars (and no gap) at ticks 2 and 7?

If that’s the case, there’s no easy solution for this issue unfortunately.

I recommend subscribing to https://github.com/plotly/plotly.js/issues/930 for the latest development info

Yes. Your understanding is correct. Thanks for filing a bug. I will keep a watch on it.

1 Like