Description Usage Arguments See Also Examples
View source: R/gradient_color.R
Change gradient color.
gradient_color()
: Change gradient color.
gradient_fill()
: Change gradient fill.
1 2 3 |
palette |
the color palette to be used for coloring or filling by groups. Allowed values include "grey" for grey color palettes; brewer palettes e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and "rickandmorty". Can be also a numeric vector; in this case a basic color palette is created using the function palette. |
set_palette.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | df <- mtcars
p <- ggscatter(df, x = "wt", y = "mpg",
color = "mpg")
# Change gradient color
# Use one custom color
p + gradient_color("red")
# Two colors
p + gradient_color(c("blue", "red"))
# Three colors
p + gradient_color(c("blue", "white", "red"))
# Use RColorBrewer palette
p + gradient_color("RdYlBu")
# Use ggsci color palette
p + gradient_color("npg")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.