Package 'mpsTemplates'

Title: Templates for Me
Description: Provides opinionated ggplot2 themes and other templates for my own use.
Authors: Michael Schramm [aut, cre]
Maintainer: Michael Schramm <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2024-11-04 05:04:28 UTC
Source: https://github.com/mps9506/mpsTemplates

Help Index


mpsTemplates: Templates for Me

Description

The mpsTemplates package provides opinionated ggplot themes

Author(s)

Maintainer: Michael Schramm [email protected]

See Also

Useful links:


Change geom defaults from black to custom lights

Description

Change geom defaults from black to custom lights

Usage

noto_dark_geom_defaults()

an opinionated ggplot2 theme

Description

Provides a ggplot2 theme.

Usage

theme_mps_noto(
  base_size = 11,
  base_family = "NotoSansDisplay_Condensed",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

default text size in px

base_family

defaults to "NotoSansDisplay_Condensed". Which is provided in the package. Generally, use a sensible sans serif font that is available on your system.

base_line_size

default line size

base_rect_size

default rect size

Details

Uses Google's Noto Sans Display font by default. Using the ragg::agg_png() or related graphics device should ensure the font is properly detected and used.

Examples

library(ggplot2)
library(ragg)

file <- tempfile(fileext = '.png')
agg_png(file)
ggplot(cars) +
  geom_point(aes(speed, dist)) +
  theme_mps_noto() +
  labs(title = "Cars", subtitle = "Speed and stopping distance",
       caption = "Ezekiel, M (1930) Methods of Correlation Analysis",
       x = "Speed [mph]",
       y = "Stopping Distance [ft]")
dev.off()

an opinionated ggplot2 theme

Description

Provides a ggplot2 theme.

Usage

theme_mps_noto_dark(
  base_size = 11,
  base_family = "NotoSansDisplay_SC",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

default text size in px

base_family

defaults to "NotoSansDisplay_Condensed". Which is provided in the package. Generally, use a sensible sans serif font that is available on your system.

base_line_size

default line size

base_rect_size

default rect size

Details

Uses Google's Noto Sans Display font by default. Using the ragg::agg_png() or related graphics device should ensure the font is properly detected and used.

Examples

library(ggplot2)
library(ragg)

file <- tempfile(fileext = '.png')
agg_png(file)
ggplot(cars) +
  geom_point(aes(speed, dist)) +
  theme_mps_noto_dark() +
  labs(title = "Cars", subtitle = "Speed and stopping distance",
       caption = "Ezekiel, M (1930) Methods of Correlation Analysis",
       x = "Speed [mph]",
       y = "Stopping Distance [ft]")
dev.off()