plotly / plotly/plotly.R

Ordering of traces is still wrong

Open
#2,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the R reproduction in the issue and compare the original ggplot output with the result from ggplotly(p). Trace how the geom_area and geom_col layers become traces; done means the converted traces preserve the intended ordering shown by the source plot.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.