edit_colors | R Documentation |
The function edit_colors()
can modify colors in existing ggplot2 plots, grid objects,
or R base plots provided as recorded plots.
edit_colors(plot = last_plot(), colfun = passthrough, fillfun = NULL,
...)
edit_grob_colors(grob, colfun, fillfun, ...)
plot |
The plot or grid graphics object to edit. The function |
colfun |
The function used to edit colors ( |
fillfun |
The function used to edit fill colors ( |
... |
Other parameters to be given to functions colfun and fillfun. |
grob |
The grid graphics object to edit. |
library(ggplot2)
library(colorspace) # for desaturate
p <- ggplot(iris, aes(Sepal.Width, fill=Species)) +
geom_density(alpha = 0.7)
p2 <- edit_colors(p, deutan)
p3 <- edit_colors(p, tritan, sev = 7)
p4 <- edit_colors(p, desaturate)
cowplot::plot_grid(p, p2, p3, p4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.