ggplot2_theme | R Documentation |
Applies common theming to a ggplot2 chart. It's based on ggplot2::theme_minimal()
.
ggplot2_theme(
base_size = 11L,
base_family = pal::pkg_config_val("font_family_body"),
base_line_size = base_size/22L,
base_rect_size = base_size/22L,
axis.title.x = ggplot2::element_text(margin = ggplot2::margin(t = 20L, r = 0L, b = 0L,
l = 0L), inherit.blank = TRUE),
axis.title.y = ggplot2::element_text(margin = ggplot2::margin(t = 0L, r = 20L, b = 0L,
l = 0L), inherit.blank = TRUE),
axis.text = ggplot2::element_text(color = "#000", inherit.blank = TRUE),
legend.box.margin = ggplot2::margin(),
legend.box.spacing = ggplot2::element_blank(),
legend.margin = ggplot2::margin(),
legend.position = "bottom",
legend.spacing = grid::unit(x = 0, units = "npc"),
plot.margin = ggplot2::margin(),
...
)
base_size |
base font size, given in pts. |
base_family |
base font family |
base_line_size |
base size for line elements |
base_rect_size |
base size for rect elements |
axis.title.x , axis.title.y |
Labels of axes ( |
axis.text |
Tick labels along axes ( |
legend.box.margin |
margins around the full legend area, as specified
using |
legend.box.spacing |
The spacing between the plotting area and the
legend box ( |
legend.margin |
the margin around each legend ( |
legend.position |
the default position of legends ("none", "left", "right", "bottom", "top", "inside") |
legend.spacing |
Spacing between legends ( |
plot.margin |
margin around entire plot ( |
... |
Further arguments passed on to |
An object of class theme
.
Other plot theming functions:
ggplot2_geom_defaults()
,
ggplot2_theme_html()
,
plotly_layout()
sysfonts::font_add_google(name = "Alegreya Sans")
showtext::showtext_auto()
ggplot2::ggplot(data = mtcars,
mapping = ggplot2::aes(x = mpg,
y = cyl)) +
ggplot2::geom_point() +
salim::ggplot2_theme(base_size = 12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.