Description Usage Arguments Details Examples
ggplot2 minimal theme which optimises font size (for web or print) and the use/orientation of gridlines (major gridlines only).
1 2 3 4 5 6 | wolves_theme(
media = "web",
grid = "hgrid",
panel_border = FALSE,
base_size = 11
)
|
media |
A string, either "print" or "web". Should the font size be optimised for print or web outputs? Default: web. |
grid |
A string, either "hgrid", "vgrid" or "fullgrid". Allows for
setting optimal orientation of gridlines and easy adjustment after using
|
panel_border |
logical, should a panel border be drawn? Intended for use with faceted plots where a panel border may be needed if there are many panels. |
base_size |
integer. Base font size, given in pts. Default: 11. |
Uses the ggplot2 theme
to set consistent plot theme elements.
Overwrites any preceding theme calls and can be overwritten by subsequent
ones.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | suppressMessages(library(dplyr))
library(ggplot2)
# wolves theme with font size optimised for web outputs
ggplot(iris, aes(x = Species, y = Sepal.Length)) +
geom_boxplot(fill = wwfc_cols("green")) +
wolves_theme(media = "web") +
labs(title = "Virginica sepals are longest",
subtitle = "Sepal length (mm) by species",
y = "")
# wolves theme with font size optimised for web outputs
ggplot(iris, aes(x = Species, y = Sepal.Length)) +
geom_boxplot(fill = wwfc_cols("green")) +
wolves_theme(media = "print") +
labs(title = "Virginica sepals are longest",
subtitle = "Sepal length (mm) by species",
y = "")
# density plot in Wolves style
ggplot(iris, aes(x = Sepal.Length, fill = Species)) +
geom_density(alpha = .7) +
wolves_theme() +
scale_y_continuous(expand = expansion(mult = c(0, .05))) +
labs(
title = "Setosa sepals may be reliably distinguished by length",
subtitle = "Distribution of sepal length (mm) by species",
y = "",
fill = ""
) +
theme(plot.title.position = "plot") +
scale_fill_wolves()
# horizontal gridlines
iris %>%
group_by(Species) %>%
summarise(mean = mean(Sepal.Length), .groups = "drop") %>%
ggplot(aes(x = Species, y = mean)) +
geom_col(fill = wwfc_cols("green")) +
wolves_theme() +
scale_y_continuous(
limits = c(0,7),
breaks = c(0:8),
expand = expansion(mult = c(0, .05))
) +
labs(title = "Virginica sepals are longest",
subtitle = "Sepal length (mm) by species",
y = "")
# vertical gridlines
iris %>%
group_by(Species) %>%
summarise(mean = mean(Sepal.Length), .groups = "drop") %>%
ggplot(aes(x = Species, y = mean)) +
geom_col(fill = wwfc_cols("green")) +
coord_flip() +
wolves_theme(grid = "vgrid") +
scale_y_continuous(
limits = c(0,7),
breaks = c(0:8),
expand = expansion(mult = c(0, .05))
) +
labs(title = "Virginica sepals are longest",
subtitle = "Sepal length (mm) by species",
y = "")
# full grid with horizontal and vertical gridlines
iris %>%
ggplot(aes(x = Sepal.Width, y = Sepal.Length, colour = Species)) +
geom_point(size = 3) +
wolves_theme(grid = "fullgrid") +
scale_colour_wolves() +
scale_x_continuous(expand = expansion(mult = c(0.05, .05))) +
labs(title = "Different strategies to achieve sepal area",
subtitle = "Sepal dimensions (mm) by species",
y = "Length",
x = "Width",
colour = "") +
theme(legend.position = "right")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.