Title: | Colour Plots with Palettes from Academic Institutions |
---|---|
Description: | Functionality to allow users to easily colour plots with the colour palettes of various academic institutions. |
Authors: | Hugh Warden [aut, cre] |
Maintainer: | Hugh Warden <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.2 |
Built: | 2025-02-19 03:44:42 UTC |
Source: | https://github.com/hwarden162/academicthemes |
Return either a specific colour palette or all colour palettes offered by
AcademicThemes
.
academic_colour_palette(palette = NA, n = NA)
academic_colour_palette(palette = NA, n = NA)
palette |
A string containing the name of the palette to be returned. If no name is given then all palettes are returned instead. |
n |
A number indicating how many different colours should be included in the palette. If not specified only the specific colours in the palette will be returned. |
A single vector or a list of vectors containing HEX codes for academic colour palettes.
# Get the colour palette used by the UKRI academic_colour_palette("ukri_mrc")
# Get the colour palette used by the UKRI academic_colour_palette("ukri_mrc")
Get The Academic Colour Palette Names
academic_colour_palette_names()
academic_colour_palette_names()
A vector of the names of the colour palettes available in AcademicThemes
.
academic_colour_palette_names()
academic_colour_palette_names()
Scale Plot Colours With Academic Themes (Continuous)
scale_colour_academic_c(palette_name, ...)
scale_colour_academic_c(palette_name, ...)
palette_name |
The name of a colour palette in |
... |
Arguments passed to |
A layer that can be added to a ggplot2 object.
library(ggplot2) ggplot( data.frame( x = runif(1500), y = runif(1500) ), aes(x = x, y = y, colour = x) ) + geom_point() + scale_colour_academic_c("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", colour = "Colour" )
library(ggplot2) ggplot( data.frame( x = runif(1500), y = runif(1500) ), aes(x = x, y = y, colour = x) ) + geom_point() + scale_colour_academic_c("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", colour = "Colour" )
Scale Plot Colours With Academic Themes (Discrete)
scale_colour_academic_d(palette_name, ...)
scale_colour_academic_d(palette_name, ...)
palette_name |
The name of a colour palette in |
... |
Arguments passed to |
A layer that can be added to a ggplot2 object.
library(ggplot2) ggplot( data.frame( x = runif(1500), y = runif(1500), c = sample(LETTERS[1:3], 1500, replace = TRUE) ), aes(x = x, y = y, colour = c) ) + geom_point() + scale_colour_academic_d("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", colour = "Colour" )
library(ggplot2) ggplot( data.frame( x = runif(1500), y = runif(1500), c = sample(LETTERS[1:3], 1500, replace = TRUE) ), aes(x = x, y = y, colour = c) ) + geom_point() + scale_colour_academic_d("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", colour = "Colour" )
Scale Plot Fills With Academic Themes (Continuous)
scale_fill_academic_c(palette_name, ...)
scale_fill_academic_c(palette_name, ...)
palette_name |
The name of a colour palette in |
... |
Arguments passed to |
A layer that can be added to a ggplot2 object.
library(ggplot2) ggplot( data.frame( x = rnorm(10000), y = rnorm(10000) ), aes(x = x, y = y) ) + geom_hex() + scale_fill_academic_c("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", fill = "Fill" )
library(ggplot2) ggplot( data.frame( x = rnorm(10000), y = rnorm(10000) ), aes(x = x, y = y) ) + geom_hex() + scale_fill_academic_c("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", fill = "Fill" )
Scale Plot Fills With Academic Themes (Discrete)
scale_fill_academic_d(palette_name, ...)
scale_fill_academic_d(palette_name, ...)
palette_name |
The name of a colour palette in |
... |
Arguments passed to |
A layer that can be added to a ggplot2 object.
library(ggplot2) ggplot( data.frame( x = LETTERS[1:5], y = 5:1 ), aes(x = x, y = y, fill = x) ) + geom_col() + scale_fill_academic_d("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", fill = "Fill" )
library(ggplot2) ggplot( data.frame( x = LETTERS[1:5], y = 5:1 ), aes(x = x, y = y, fill = x) ) + geom_col() + scale_fill_academic_d("cruk") + theme_classic() + labs( x = "X-Axis", y = "Y-Axis", fill = "Fill" )