colors="" parameter cannot be used on multiple traces in one plot
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
I have defined two vectors of colors (col1, col2) and I want to apply each color vector to two corresponding traces inside my plot using the colors parameter. But, Plotly ignores col2 and uses col1 for both traces.
col1 <- c("#e65353", "#62e653", "#53a4e6", "#53e6da", "#e6b053")
col2 <- c("#b72b7f", "#2ba5b7", "#3e8236", "#f87b60", "#000000")
iris %>%
plot_ly() %>%
add_trace(x = ~Sepal.Length, y = 0.3, color = ~Species, colors = col1) %>%
add_trace(x = ~Sepal.Width, y = 0.6, color = ~Species, colors = col2)

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reproducible R example with iris, plot_ly(), and two add_trace() calls using col1 and col2. Trace how the colors parameter is handled across multiple traces; done when the second trace uses col2 rather than col1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100