Description Usage Arguments Functions Fonts References See Also Examples
View source: R/theme_pomological.R
ggplot2 plot theme based on the USDA Pomological Watercolors paintings.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | theme_pomological(
base_family = NULL,
base_size = 11,
text.color = pomological_base$dark_blue,
plot.background.color = pomological_base$paper,
panel.border.color = pomological_base$light_line,
with.panel.grid = FALSE,
panel.grid.color = pomological_base$light_line,
panel.grid.linetype = "dashed",
axis.text.color = pomological_base$medium_line,
axis.text.size = base_size * 3/4,
base_theme = ggplot2::theme_minimal()
)
theme_pomological_nobg(..., plot.background.color = "transparent")
theme_pomological_plain(
base_family = "",
base_size = 11,
plot.background.color = "transparent",
...
)
theme_pomological_fancy(base_family = "Homemade Apple", base_size = 16, ...)
|
base_family |
Base text family. See Fonts in |
base_size |
Base text size |
text.color |
Color of all text (except axis text, see |
plot.background.color |
Color of plot background, passed to |
panel.border.color |
Color of plot panel border |
with.panel.grid |
If |
panel.grid.color, panel.grid.linetype |
Color and linetype of panel grid, passed to |
axis.text.color, axis.text.size |
Color and size of axis text |
base_theme |
Starting theme of plot, default is
|
theme_pomological_nobg
: Pomological theme with white (transparent) background
theme_pomological_plain
: A "plain" pomological theme with white
background and normal fonts.
theme_pomological_fancy
: A "fancy" pomological theme with fancy fonts
Complete the pomological watercolor theme with a handwriting or cursive font. The following fonts from Google Fonts work well. Visit the links below to install on your system.
Fonts with R are notoriously tricky, so these may not work well for you. If
you have installed the fonts but they aren't showing up or working, you can
always try running extrafont::font_import()
or extrafont::load_fonts()
in
the session or RMarkdown document. Or you can use theme_pomological_plain()
.
https://usdawatercolors.nal.usda.gov/pom
ggplot2::theme
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 | library(ggplot2)
# Prep msleep data
msleep <- ggplot2::msleep[, c("vore", "sleep_rem", "sleep_total")]
msleep <- msleep[complete.cases(msleep), ]
msleep$vore <- paste0(msleep$vore, "vore")
# Base plot
basic_msleep_plot <- ggplot(msleep) +
aes(x = sleep_rem, y = sleep_total, color = vore) +
geom_point(size = 2) +
labs(color = NULL)
# Just your standard ggplot
basic_msleep_plot
# With pomological colors
basic_msleep_plot <- basic_msleep_plot + scale_color_pomological()
basic_msleep_plot
# With pomological theme
basic_msleep_plot + theme_pomological()
# With transparent background
basic_msleep_plot + theme_pomological_plain()
# Or with "fancy" pomological settings
pomological_msleep <- basic_msleep_plot + theme_pomological_fancy()
# Painted!
paint_pomological(pomological_msleep, res = 110)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.