use_sgplot | R Documentation |
Set sgplot theme, colour palette and geom aesthetic defaults for ggplot2 charts.
use_sgplot(palette_type = "sg", ..., default_colour = deprecated())
palette_type |
Name of palette type to use. Defaults to "sg". For all
available palette types, run |
... |
Arguments passed to |
default_colour |
NULL. Function is used for side effects of setting default ggplot2 theme, colour palette and geom aesthetics.
library(ggplot2)
d <- subset(mpg, manufacturer == "ford")
# ggplot2 defaults
ggplot(d, aes(x = model)) + geom_bar()
ggplot(d, aes(x = model, fill = class)) + geom_bar()
# Use sgplot defaults
use_sgplot()
ggplot(d, aes(x = model)) + geom_bar()
ggplot(d, aes(x = model, fill = class, colour = class)) + geom_bar()
# Use sgplot defaults and Social Security Scotland colour palettes
use_sgplot(palette_type = "sss")
ggplot(d, aes(x = model)) + geom_bar()
ggplot(d, aes(x = model, fill = class, colour = class)) + geom_bar()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.