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 |
Function for printing palette
## S3 method for class 'palette' print(x, ...)
## S3 method for class 'palette' print(x, ...)
x |
the object to be printed. |
... |
further arguments to be passed to or from other methods. They are ignored in this function. |
A plot of the specified colour palette.
print(RSScols("signif_qual"))
print(RSScols("signif_qual"))
Generates the colour palettes
RSScols(palette, n, type = "discrete", direction = 1)
RSScols(palette, n, type = "discrete", direction = 1)
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 |
A character vector of hex colour codes.
RSScols("signif_seq")
RSScols("signif_seq")
Use names(RSSPalettes)
to return all palette names.
RSSPalettes
RSSPalettes
An object of class list
of length 3.
Plotting with RSS palettes for colour ggplot2
scale_color_rss_c(palette, direction = 1, ...)
scale_color_rss_c(palette, direction = 1, ...)
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 |
A ggproto object defining a continuous colour scale for use with ggplot2.
library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) + geom_point() + scale_color_rss_c(palette = "signif_seq")
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
scale_color_rss_d(palette, direction = 1, ...)
scale_color_rss_d(palette, direction = 1, ...)
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 |
A ggproto object defining a discrete colour scale for use with ggplot2.
library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, color = factor(cyl))) + geom_point() + scale_color_rss_d(palette = "signif_qual")
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
scale_colour_rss_c(palette, direction = 1, ...)
scale_colour_rss_c(palette, direction = 1, ...)
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 |
A ggproto object defining a continuous colour scale for use with ggplot2.
library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) + geom_point() + scale_colour_rss_c(palette = "signif_seq")
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
scale_colour_rss_d(palette, direction = 1, ...)
scale_colour_rss_d(palette, direction = 1, ...)
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 |
A ggproto object defining a discrete colour scale for use with ggplot2.
library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, color = factor(cyl))) + geom_point() + scale_colour_rss_d(palette = "signif_qual")
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
scale_fill_rss_c(palette, direction = 1, ...)
scale_fill_rss_c(palette, direction = 1, ...)
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 |
A ggproto object defining a continuous colour scale for use with ggplot2.
library(ggplot2) ggplot(data = mtcars, aes(x = cyl, y = disp, fill = cyl)) + geom_col() + scale_fill_rss_c(palette = "signif_seq")
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
scale_fill_rss_d(palette, direction = 1, ...)
scale_fill_rss_d(palette, direction = 1, ...)
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 |
A ggproto object defining a discrete fill scale for use with ggplot2.
library(ggplot2) ggplot(data = mtcars, aes(x = cyl, y = disp, fill = factor(cyl))) + geom_col() + scale_fill_rss_d(palette = "signif_qual")
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
set_rss_palette(palette)
set_rss_palette(palette)
palette |
Name of palette. See |
Returns a character vector giving the colors from the palette which was in effect. This is invisible unless the argument is omitted.
set_rss_palette("signif_qual")
set_rss_palette("signif_qual")
Set Significance base R graphical parameters
set_signif_par( family = "Source Sans Pro", adj = 0, mar = c(5, 3, 3, 2.5), bty = "n", ... )
set_signif_par( family = "Source Sans Pro", adj = 0, mar = c(5, 3, 3, 2.5), bty = "n", ... )
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 |
Returns an invisible named list.
# 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)
# 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
signif_blue
signif_blue
An object of class character
of length 1.
Significance green hex colour
signif_green
signif_green
An object of class character
of length 1.
Significance orange hex colour
signif_orange
signif_orange
An object of class character
of length 1.
Significance red hex colour
signif_red
signif_red
An object of class character
of length 1.
Significance yellow hex colour
signif_yellow
signif_yellow
An object of class character
of length 1.
Custom ggplot theme
theme_significance( family = "Source Sans Pro", base_size = 13, hjust = 0, text_col = "black", bg_col = "white" )
theme_significance( family = "Source Sans Pro", base_size = 13, hjust = 0, text_col = "black", bg_col = "white" )
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". |
A ggplot2 theme
library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) + geom_point() + theme_significance()
library(ggplot2) ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) + geom_point() + theme_significance()
Prints all available colour palettes
view_all_palettes()
view_all_palettes()
A plot of all colour palettes available in the package.
view_all_palettes()
view_all_palettes()