Package 'tgamtheme'

Title: Globe and Mail Graphics Theme for 'ggplot2'
Description: Theme and colour palettes for The Globe and Mail's graphics. Includes colour and fill scale functions, colour palette helpers and a Globe-styled 'ggplot2' theme object.
Authors: Tom Cardoso [aut, cre] (creator and maintainer)
Maintainer: Tom Cardoso <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-13 02:57:41 UTC
Source: https://github.com/globeandmail/tgamtheme

Help Index


Color scale constructor for The Globe and Mail's colors

Description

Color scale constructor for The Globe and Mail's colors

Usage

scale_color_tgam(palette = "main", discrete = TRUE, reverse = FALSE, ...)

scale_colour_tgam(palette = "main", discrete = TRUE, reverse = FALSE, ...)

Arguments

palette

Character name of palette in tgam_palettes. Currently, one of 'main' or 'alternate'.

discrete

Boolean indicating whether color aesthetic is discrete or not

reverse

Boolean indicating whether the palette should be reversed

...

Additional arguments passed to discrete_scale() or scale_color_gradientn(), used respectively when discrete is TRUE or FALSE

Value

A ggplot2 colour scale object, to be passed to a ggplot2 object

Examples

library(ggplot2)
ggplot(diamonds, aes(depth, color = cut)) +
  geom_density() +
  xlim(55, 70) +
  scale_color_tgam()

Fill scale constructor for The Globe and Mail's colors

Description

Fill scale constructor for The Globe and Mail's colors

Usage

scale_fill_tgam(palette = "main", discrete = TRUE, reverse = FALSE, ...)

Arguments

palette

Character name of palette in tgam_palettes. Currently, one of 'main' or 'alternate'.

discrete

Boolean indicating whether color aesthetic is discrete or not

reverse

Boolean indicating whether the palette should be reversed

...

Additional arguments passed to discrete_scale() or scale_fill_gradientn(), used respectively when discrete is TRUE or FALSE

Value

A ggplot2 colour scale object, to be passed to a ggplot2 object

Examples

library(ggplot2)
ggplot(diamonds, aes(carat, fill = cut)) +
  geom_density(position = 'fill') +
  scale_fill_tgam()

Function to extract The Globe and Mail's colors as hex codes

Description

Function to extract The Globe and Mail's colors as hex codes

Usage

tgam_cols(...)

Arguments

...

Character names of tgam_colors. Colour names include 'burgundy', 'sky', 'salmon', 'gold', 'gray', 'alt1', 'alt2', 'alt3', 'alt4', 'alt5'.

Value

A character vector of one or more colours in The Globe's palette

Examples

tgam_cols()
tgam_cols('burgundy')

Return function to interpolate a Globe and Mail color palette

Description

Return function to interpolate a Globe and Mail color palette

Usage

tgam_pal(palette = "main", reverse = FALSE, ...)

Arguments

palette

Character name of palette in tgam_palettes. Currently, one of 'main' or 'alternate'.

reverse

Boolean indicating whether the palette should be reversed

...

Additional arguments to pass to colorRampPalette()

Value

A character vector of interpolated colour values

Examples

tgam_pal()(3)
tgam_pal(palette = 'alternate')(3)

ggplot Globe and Mail theme

Description

Theme function to be passed as an argument during ggplot2 charting.

Usage

theme_tgam(
  size = 12,
  family = "GMsanC-Regular",
  title = "GMsanC-Bold",
  position = "center"
)

Arguments

size

Base font size

family

Font family

title

Font to use for title text

position

How should headings be positioned? Options are 'center' or 'left'. (Default: 'center',)

Value

A ggplot2 theme object, to be passed to a ggplot2 object