plotly / plotly/plotly.R

Multiple aestetics in scale_*_virids_d() not supported

Open
#1,933 0 comments 1 reaction 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

I tried to convert the following (simplified) ggplot2 object into a plotly object:

library(ggplot2)
library(plotly)

plot <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species, fill = Species)) + 
  geom_point() + 
  scale_fill_viridis_d(option = "viridis", aesthetics = c("colour", "fill"))

Using ggplotly(plot) throws the error

Error in [[<-(*tmp*, sc$aesthetics, value = sc) : no such index at level 1

Separating the aesthetics works fine as does specifying only one argument in the "aesthetic" argument or writing a line for each aesthetic.

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 reproducing the provided R example using ggplotly() and scale_fill_viridis_d() with both colour and fill aesthetics. Trace the conversion from that entry point to identify why multiple aesthetics cause the error, then verify that the example works while single-aesthetic and separate-scale cases remain supported.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.