theme_council: Council ggplot2 theme

View source: R/theme_council.R

theme_councilR Documentation

Council ggplot2 theme

Description

The default theme_council() plus a more simple theme_council_open() for making MetCouncil figures. theme_council() will be appropriate in most cases while theme_council_open() is appropriate for single scatter plots or line graphs. For geospatial plots, theme_council_geo() may be useful to set some initial parameters.

Please note that the y-axis text is horizontal, and long axis names will need to be wrapped; stringr::str_wrap() is useful for managing length. For example, consider using this piece of code: labs(y = stringr::str_wrap("Axis labels are now horizontal, but you still need to insert some code to wrap long labels", width = 15))

Usage

theme_council(
  base_size = 11,
  base_family = "",
  base_line_size = base_size/22,
  base_rect_size = base_size/22,
  use_showtext = FALSE,
  use_manual_font_sizes = FALSE,
  font_sizes = list(title = 22, subtitle = 16, axis_title = 14, axis_text = 11,
    legend_title = 14, legend_text = 10, caption = 8, strip = 14)
)

theme_council_open(...)

theme_council_geo(...)

Arguments

base_size

numeric, base font size, given in pts. Default is 11

base_family

character, base font family. Default is ""

base_line_size

numeric, base size for line elements. Default is base_size/22

base_rect_size

numeric, base size for rect elements. Default is base_size/22

use_showtext

logical, whether to use Council fonts.

use_manual_font_sizes

logical, use supplied font sizes.

font_sizes

named list, font sizes. Only used if use_manual_font_sizes is TRUE

...

arguments passed to theme_council()

Value

a ggplot2::theme() object

Council fonts

There are a few requirements needed if you want to use Council font families.

  1. You must have the optional {showtext} and {sysfonts} packages installed.

  2. You must have the following fonts installed:

  • HelveticaNeueLT Standard Light, Standard Condensed, and Standard Medium Condensed

  • Arial Narrow

  • Palatino Linotype If you do not have the font files handy, contact a package author or your manager.

Font size suggestions

Generally, font sizes should be no smaller than 11 point.

If you are creating plots for a presentation, you should increase all font sizes. Check the default font sizes in the presentation platform you are working in and adjust from there. For example, Microsoft PowerPoint sets slide headings at 77 point and body text at 46 point. You will likely want to make the plot title less than 77 point so you can preserve the text hierarchy in the slide.

Theme modifications

If you wish to make changes to this theme template, such as removing the legend, adjusting text positions, access the source code by typing councilR::theme_council in the console. You can then copy/paste the function into whatever document you are working on and make changes there.

If you want to make a change to the default template, open an Issue on GitHub and ask for the change to be made, and/or make the change yourself and make a pull request.

Note

This function relies on {rlang} internal functions. Further examples in vignette("Color").

See Also

Other aesthetics: blue_cascade, colors, council.pal(), council_layout(), council_pal2(), map_council_continuous(), scale_color_council(), scale_fill_council()

Examples

## Not run: 
library(ggplot2)
library(councilR)

ggplot(datasets::iris) +
  aes(Sepal.Length, Sepal.Width, color = Species) +
  geom_point() +
  scale_color_viridis_d() +
  theme_council(
    use_showtext = TRUE,
    use_manual_font_sizes = TRUE
  )

fetch_ctu_geo() %>%
  ggplot() +
  geom_sf() +
  theme_council_geo()

## End(Not run)


Metropolitan-Council/councilR documentation built on March 30, 2024, 2:43 a.m.