Title: | RSS Palettes and Themes |
Version: | 1.0.0 |
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. |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Depends: | R (≥ 3.6) |
Imports: | ggplot2, graphics, grDevices, purrr, showtext, sysfonts |
Suggests: | covr, knitr, markdown, rmarkdown, testthat (≥ 3.0.0) |
License: | CC BY 4.0 |
URL: | https://github.com/nrennie/RSSthemes |
BugReports: | https://github.com/nrennie/RSSthemes/issues |
NeedsCompilation: | no |
Packaged: | 2023-08-29 16:53:28 UTC; nrenn |
Author: | Nicola Rennie [aut, cre], Royal Statistical Society [fnd, cph] |
Maintainer: | Nicola Rennie <nrennie35@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-08-29 17:10:14 UTC |
Complete list of palettes.
Description
Use names(RSSPalettes)
to return all palette names.
Usage
RSSPalettes
Format
An object of class list
of length 3.
Generates the colour palettes
Description
Generates the colour palettes
Usage
RSScols(palette, n, type = "discrete", direction = 1)
Arguments
palette |
Name of Palette. Run |
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")
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"))
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 |
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 |
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 |
direction |
Sets order of colors. Default direction is 1. If direction is -1, palette color order is reversed |
... |
Other arguments passed on to |
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 |
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 |
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 |
direction |
Sets order of colors. Default direction is 1. If direction is -1, palette color order is reversed |
... |
Other arguments passed on to |
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 |
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 |
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 |
direction |
Sets order of colors. Default direction is 1. If direction is -1, palette_choice color order is reversed |
... |
Other arguments passed on to |
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 |
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 |
bty |
Axis lines. Default "n". |
... |
Additional arguments passed to |
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()