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

Ordering of traces is still wrong

Open travis-leith opened this issue 3 years ago • 0 comments

Following on from #225, here is an an example where ordering of traces is wrong

set.seed(12345)

df1 = data.frame(
  x = seq(1, 200), y = 100 + cumsum(rnorm(200))
)

y.sparse = local({
  i = sample(200, 10)
  res = rep(0, 200)
  res[i] = 120 + cumsum(rnorm(10))
  res
})

df2 = data.frame(
  x = seq(1, 200), y = y.sparse
)

p = ggplot(mapping = aes(x = x, y = y)) +
  geom_area(data = df1) + 
  geom_col(data = df2, fill = "red")

p

ggplotly(p)

image

image

travis-leith avatar May 12 '22 10:05 travis-leith