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
I don't know if there is much demand for such a feature, but I often find myself wanting to modify ggplot objects after they are constructed (zapping a layer, for example), but in order to do so, I need to know the index of the layer to modify.
Could there be a name parameter for layers?
df <-
tibble(x = runif(1000, 0, 1)) %>%
mutate(y = x + runif(1000, x, 1))
g <-
df %>%
ggplot() +
geom_point(aes(x = x, y = y), alpha = 0.2) +
geom_smooth(aes(x = x, y = y))
g$layers[[1]] <- NULL
# would rather do something like
# ... +
# geom_point(aes(x = x, y = y), alpha = 0.2, name = "scatter") +
# ...
#
# g$layers[["scatter"]] <- NULL
The text was updated successfully, but these errors were encountered:
I think there are many future scenarios where named layers would be beneficial so we should definetly look into that. I've also wanted it for gganimate and ggforce to better target effects on specific layers
I don't know if there is much demand for such a feature, but I often find myself wanting to modify
ggplot
objects after they are constructed (zapping a layer, for example), but in order to do so, I need to know the index of the layer to modify.Could there be a
name
parameter for layers?The text was updated successfully, but these errors were encountered: