Skip to content
Prev 387485 / 398502 Next

Plot_ly bar plots - bars span sevral x values when there are missing values.

Hi Rasmus,

thanks for that suggestion. It does indeed fix the column widths in this
example.  the reason it does this is becuase it means that the additonal 0
values added result in values for two adjacent columns.

so if adjacent columns are present the "correct" column width is maintained

df[c(3,4),]%>%plot_ly(
  x =  ~ x,
  y =  ~ y,
  type = "bar")%>%
  layout(xaxis = list(range = c(0,20)),
         title = "adjcant x values get correct column width")
however if there are not tow adjacent columns  then the width increases

df[c(3,5),]%>%plot_ly(
  x =  ~ x,
  y =  ~ y,
  type = "bar")%>%
  layout(xaxis = list(range = c(0,20)),
         title = "gap between x values column width changes")

given this I'm still not sure why the single value example produces a
correct column width.

for now the generic work around is to pad with y=0 as you suggested.
On Wed, 10 Mar 2021 at 05:58, Rasmus Liland <jral at posteo.no> wrote: