-
Notifications
You must be signed in to change notification settings - Fork 636
Open
Description
If you create a manual colour scale mapping for an aesthetic that isn't used {ggplot2} doesn't care, but {plotly} cannot successfully convert the plot.
This might show up if you try to create an organisational colour scale theme you want the user to use as a one liner, without care for the underlying aesthetics in play (works well with native ggplot2).
Reprex:
library(plotly)
#> Loading required package: ggplot2
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
library(ggplot2)
library(palmerpenguins)
p <-
penguins |>
ggplot(aes(
x = body_mass_g,
y = bill_length_mm,
colour = species
)) +
geom_point() +
scale_colour_manual(
values = c(
"Adelie" = "red",
"Chinstrap" = "green",
"Gentoo" = "blue"
),
aesthetics = c("colour", "fill")
)
ggplotly(p)
#> Error in `[.data.frame`:
#> ! undefined columns selectedCreated on 2026-01-09 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels