-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
featurea feature request or enhancementa feature request or enhancement
Description
ggplot_add.list()
adds each element of the list using %+%
instead of +
here:
Lines 156 to 161 in ca47270
ggplot_add.list <- function(object, plot, object_name) { | |
for (o in object) { | |
plot <- plot %+% o | |
} | |
plot | |
} |
The idea is that ggplot() + list(e1, e2, e3)
should be the same as ggplot() + e1 + e2 + e3
, but this is not true if someone (😇) wanted to create a gg subclass with a custom +
method.
I'm not sure why that code uses %+%
instead of +
. I modified the code and run tests both ways and everything passes. This logic has been since 3c16f9c from 2017
Would it be possible to change ggplot_add.list()
to use the +
generic? Barring that, would it be possible to make %+%
an exported generic (same as +
)?
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement