Calculation fails when global aesthetic values contain something not supported by geom
atusy opened this issue · comments
See example below.
It works if removing shape = legend
from aes()
or gghighlight::gghighlight(legend == 'a')
from layers.
reprex
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
data.frame(
X = c(1, 2, 1, 2),
Y = c(1, 1, 2, 2),
legend = c('a', 'a', 'b', 'b')
) %>%
ggplot() +
aes(X, Y, color = legend, shape = legend) +
geom_line() +
gghighlight::gghighlight(legend == 'a')
#> Warning: Tried to calculate with group_by(), but the calculation failed.
#> Falling back to ungrouped filter operation...
#> label_key: legend
#> Don't know how to automatically pick scale for object of type function. Defaulting to continuous.
#> Error: A continuous variable can not be mapped to shape
Created on 2020-07-25 by the reprex package (v0.3.0)
Let me add a background.
I wanted to add geom_point()
, which uses the shape
.
A workaround is to map shape
within geom_point
.
Confirmed, thanks.