You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unused aesthetic in scale_*_manual causes ggplotly conversion to fail #2466
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 selected
Activity
Fix #2466: scale_*_manual with unused aesthetics no longer errors
Fix #2466: scale_*_manual with unused aesthetics no longer errors
Fix #2466: scale_*_manual with unused aesthetics no longer errors
Fix multiple ggplotly() regressions (#2469)