plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

Incorrect warning in `layout()` when using `bargroupgap`

Open SCasanova opened this issue 3 months ago • 0 comments

When using the bargroupgap argument, the following waring is thrown:

Warning message: 'layout' objects don't have these attributes: 'bargroupgap' Valid attributes include: ...

However the attribute clearly exists and works

library(ggplot2)
library(plotly)


test <- tibble::tibble(
  A = c(1,2,3),
  B = c(3,2,1),
  C = c(4,1,4)
)

plot_ly(
  test,
  y = ~A,
  type = 'bar',
  name = 'Option A',
  marker = list(
    color = '#4E0F53'
  )
) |> 
  add_trace(
    y = ~B,
    name = 'Option B',
    marker = list(
      color = '#DC9542'
    )
  ) |> 
  add_trace(
    y = ~C,
    name = 'Option C',
    marker = list(
      color = '#a8aaad'
    )
  ) |> 
  layout(
    barmode = 'group',
    bargroupgap = 0.1
  )

Image


plot_ly(
  test,
  y = ~A,
  type = 'bar',
  name = 'Option A',
  marker = list(
    color = '#4E0F53'
  )
) |> 
  add_trace(
    y = ~B,
    name = 'Option B',
    marker = list(
      color = '#DC9542'
    )
  ) |> 
  add_trace(
    y = ~C,
    name = 'Option C',
    marker = list(
      color = '#a8aaad'
    )
  ) |> 
  layout(
    barmode = 'group'
  )
Image

SCasanova avatar Oct 21 '25 19:10 SCasanova