Package 'RSSthemes'

Title: RSS Palettes and Themes
Description: Defines colour palettes and themes for Royal Statistical Society (RSS) publications, including Significance magazine. Palettes and themes are supported in both base R and 'ggplot2' graphics, and are intended to be used by authors submitting to RSS publications.
Authors: Nicola Rennie [aut, cre], Royal Statistical Society [fnd, cph]
Maintainer: Nicola Rennie <[email protected]>
License: CC BY 4.0
Version: 1.0.0.9003
Built: 2024-11-01 04:24:35 UTC
Source: https://github.com/nrennie/rssthemes

Help Index


Function for printing palette

Description

Function for printing palette

Usage

## S3 method for class 'palette'
print(x, ...)

Arguments

x

the object to be printed.

...

further arguments to be passed to or from other methods. They are ignored in this function.

Value

A plot of the specified colour palette.

Examples

print(RSScols("signif_qual"))

Generates the colour palettes

Description

Generates the colour palettes

Usage

RSScols(palette, n, type = "discrete", direction = 1)

Arguments

palette

Name of Palette. Run names(RSSPalettes) to view options.

n

Number of desired colors. If number of requested colors is beyond the scope of the palette, colors are automatically interpolated. If n is not provided, the length of the palette is used.

type

Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colors. Default "discrete"

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

Value

A character vector of hex colour codes.

Examples

RSScols("signif_seq")

Complete list of palettes.

Description

Use names(RSSPalettes) to return all palette names.

Usage

RSSPalettes

Format

An object of class list of length 3.


Plotting with RSS palettes for colour ggplot2

Description

Plotting with RSS palettes for colour ggplot2

Usage

scale_color_rss_c(palette, direction = 1, ...)

Arguments

palette

name of palette. Run names(RSSPalettes) to view options.

direction

Sets order of colors. Default palette_choice is 1. If direction is -1, palette_choice color order is reversed

...

Other arguments passed on to scale_color_gradientn

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) +
  geom_point() +
  scale_color_rss_c(palette = "signif_seq")

Plotting with RSS palettes for colour ggplot2

Description

Plotting with RSS palettes for colour ggplot2

Usage

scale_color_rss_d(palette, direction = 1, ...)

Arguments

palette

Name of Palette. Run palettes(RSSPalettes) to view options.

direction

Sets order of colors. Default direction is 1. If direction is -1, palette color order is reversed

...

Other arguments passed on to discrete_scale

Value

A ggproto object defining a discrete colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = factor(cyl))) +
  geom_point() +
  scale_color_rss_d(palette = "signif_qual")

Plotting with RSS palettes for colour ggplot2

Description

Plotting with RSS palettes for colour ggplot2

Usage

scale_colour_rss_c(palette, direction = 1, ...)

Arguments

palette

name of palette. Run names(RSSPalettes) to view options.

direction

Sets order of colors. Default palette_choice is 1. If direction is -1, palette_choice color order is reversed

...

Other arguments passed on to scale_color_gradientn

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) +
  geom_point() +
  scale_colour_rss_c(palette = "signif_seq")

Plotting with RSS palettes for colour ggplot2

Description

Plotting with RSS palettes for colour ggplot2

Usage

scale_colour_rss_d(palette, direction = 1, ...)

Arguments

palette

Name of Palette. Run names(RSSPalettes) to view options.

direction

Sets order of colors. Default direction is 1. If direction is -1, palette color order is reversed

...

Other arguments passed on to discrete_scale

Value

A ggproto object defining a discrete colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = factor(cyl))) +
  geom_point() +
  scale_colour_rss_d(palette = "signif_qual")

Plotting with RSS palettes for fill with ggplot2

Description

Plotting with RSS palettes for fill with ggplot2

Usage

scale_fill_rss_c(palette, direction = 1, ...)

Arguments

palette

name of palette. Run names(RSSPalettes) to view options.

direction

Sets order of colors. Default palette_choice is 1. If direction is -1, palette_choice color order is reversed

...

Other arguments passed on to scale_fill_gradientn

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = cyl, y = disp, fill = cyl)) +
  geom_col() +
  scale_fill_rss_c(palette = "signif_seq")

Plotting with RSS palettes for fill colour ggplot2

Description

Plotting with RSS palettes for fill colour ggplot2

Usage

scale_fill_rss_d(palette, direction = 1, ...)

Arguments

palette

name of palette. Run names(RSSPalettes) to view options.

direction

Sets order of colors. Default direction is 1. If direction is -1, palette_choice color order is reversed

...

Other arguments passed on to discrete_scale

Value

A ggproto object defining a discrete fill scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = cyl, y = disp, fill = factor(cyl))) +
  geom_col() +
  scale_fill_rss_d(palette = "signif_qual")

Set RSS base R plotting palette

Description

Set RSS base R plotting palette

Usage

set_rss_palette(palette)

Arguments

palette

Name of palette. See names(RSSthemes::RSSPalettes).

Value

Returns a character vector giving the colors from the palette which was in effect. This is invisible unless the argument is omitted.

Examples

set_rss_palette("signif_qual")

Set Significance base R graphical parameters

Description

Set Significance base R graphical parameters

Usage

set_signif_par(
  family = "Source Sans Pro",
  adj = 0,
  mar = c(5, 3, 3, 2.5),
  bty = "n",
  ...
)

Arguments

family

Font used for all text elements. Default "Source Sans Pro".

adj

Alignment of text for title. Default 0.

mar

Margins. Default c(5, 3, 3, 2.5).

bty

Axis lines. Default "n".

...

Additional arguments passed to par

Value

Returns an invisible named list.

Examples

# save user's current par values that this function will change
oldpar <- par("family", "adj", "mar", "bty")
set_signif_par()
plot(1:4, 1:4, col=1:4, main = "Title")
par(oldpar)

Significance blue hex colour

Description

Significance blue hex colour

Usage

signif_blue

Format

An object of class character of length 1.


Significance green hex colour

Description

Significance green hex colour

Usage

signif_green

Format

An object of class character of length 1.


Significance orange hex colour

Description

Significance orange hex colour

Usage

signif_orange

Format

An object of class character of length 1.


Significance red hex colour

Description

Significance red hex colour

Usage

signif_red

Format

An object of class character of length 1.


Significance yellow hex colour

Description

Significance yellow hex colour

Usage

signif_yellow

Format

An object of class character of length 1.


Significance theme

Description

Custom ggplot theme

Usage

theme_significance(
  family = "Source Sans Pro",
  base_size = 13,
  hjust = 0,
  text_col = "black",
  bg_col = "white"
)

Arguments

family

Font used for all text elements. Default "Source Sans Pro".

base_size

Base font size for text elements. Default 12.

hjust

Horizontal alignment of title, subtitle, and caption. Default 0.

text_col

Text colour. Default "black".

bg_col

Background colour. Default "white".

Value

A ggplot2 theme

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) +
  geom_point() +
  theme_significance()

Prints all available colour palettes

Description

Prints all available colour palettes

Usage

view_all_palettes()

Value

A plot of all colour palettes available in the package.

Examples

view_all_palettes()