theme_unhcr
provides a basic UNHCR theme
to use in ggplot2
commands.
theme_unhcr(
font_family = if (lato_installed()) "Lato" else "sans",
font_size = 12,
plot_title_size = rel(1.35),
plot_title_margin = font_size,
subtitle_size = font_size,
subtitle_margin = font_size * 1.5,
strip_text_size = rel(0.9),
strip_text_face = "bold",
strip_text_just = 0,
caption_size = rel(0.7),
caption_margin = font_size,
axis_text = TRUE,
axis_text_size = rel(0.9),
axis_title = TRUE,
axis_title_size = rel(0.9),
axis = FALSE,
axis_ticks = FALSE,
grid = "XY",
legend = TRUE,
legend_text_size = rel(0.9),
legend_title = FALSE,
legend_title_size = rel(0.9),
plot_margin = margin(font_size, font_size, font_size, font_size),
plot_background = "#ffffff",
void = FALSE
)
A ggplot2 theme object, the theme style.
Base font family "Lato". You need to have "Lato" font installed on your device in order to use it.
Base font size in pt. Default to 12 pts.
Plot title font size. Default to font_size
* 1.35.
Plot title bottom margin. Default to font_size
.
Plot subtitle font size. Default to font_size
.
Plot subtitle bottom margin.
Default to font_size
* 1.5.
Facet label font size. Default to font_size
* 0.9.
Facet label font face. Default to "bold".
Facet label justification. Default to 0.
Caption font size. Default to font_size
* 0.7.
Caption top margin. Default to font_size
.
Logical TRUE
/FALSE
or xy
. Turn on and off axis label.
Use x
or y
to have only the correspondent active. Default to TRUE
.
Axis label font size. Default to font_size
* 0.9.
Logical TRUE
/FALSE
or xy
. Turn on and off axis title.
Use x
or y
to have only the correspondent active. Default to TRUE
.
Axis title font size. Default to font_size
* 0.9.
Logical TRUE
/FALSE
or xy
. Turn on and off axis.
Use x
or y
to have only the correspondent axis active.
Don't forget to review the expand
argument of the scale_x_*
/scale_y_*
to avoid spacing between the axis and the baseline of the plot.
Default to FALSE
.
Logical TRUE
/FALSE
or xy
. Turn on and off axis ticks.
Use x
or y
to have only the correspondent axis ticks active.
Default to FALSE
.
Logical TRUE
/FALSE
or a combination of X
or x
and Y
or y. Turn on and off panel grids. Use
Xor
Yfor major grids, and
xor
yfor minor grid. Default to
XY`.
Logical TRUE
/FALSE
. Turn on and off the legend.
Default to TRUE
.
Legend key font size. Default to font_size
* 0.9.
Logical TRUE
/FALSE
. Turn on and off the legend title.
Default to FALSE
.
Legend title font size.
Default to font_size
* 0.9.
Plot margin (see margin
).
Default to ggplot2::margin(font_size, font_size, font_size, font_size)
.
Plot background. Put "transparent" for no background color. Default to "white".
Logical TRUE
/FALSE
. If TRUE
, all grid lines, ticks
and axes are removed. Default to FALSE
.
theme_minimal
,
element_text
,
ggtext::element_textbox_simple
if (FALSE) {
library(ggplot2)
data(mpg, package = "ggplot2")
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme_unhcr()
}
Run the code above in your browser using DataLab