Description Usage Arguments Details Examples
The %L+%
(L-plus) operator allows you to add components to a ggloop
object - whether that object is a:
nested list of ggplot plots
list of ggplot plots
single ggplot.
1 2 3 4 | lhs %L+% rhs
## S3 method for class 'gglist'
lhs + rhs
|
lhs |
Typically the returned object by |
rhs |
A geom, stat, or other layer feature from the |
%L+%
borrows HEAVILY from magrittr
, and in fact uses the same
yet-tweaked functions as magrittr, minus a few others. It is a substitute for
+
and is used in the same fashion: to add geoms, stats, aesthetics,
facets, and other features to ggplot
object. The returned object from
ggloop()
is often a nested list of ggplot
objects. However it
is possible to use %L+%
in place of where +
would normally be
used. This is due to the conditional statements present in %L+%
's
structure.
1 2 3 4 5 6 7 8 9 | # Add component to entire list.
g <- ggloop(mtcars, aes_loop(x = mpg:hp, y = mpg:hp))
g <- g %L+% ggplot2::geom_point()
# Add component to a subset of a list
g2 <- ggloop(mtcars, aes_loop(x = disp:wt, y = disp:wt, color = c(cyl, gear)))
g2$color.gear <- g2$color.gear %L+% ggplot2::geom_point()
g2$color.cyl[1:3] <- g2$color.cyl[1:3] %L+% ggplot2::geom_point()
g2$color.cyl$x.hp_y.drat <- g2$color.cyl$x.hp_y.drat %L+% ggplot2::geom_point()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.