Package 'AcademicThemes'

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: 2024-06-24 04:03:45 UTC
Source: https://github.com/hwarden162/academicthemes

Help Index


Get An Academic Colour Palette

Description

Return either a specific colour palette or all colour palettes offered by AcademicThemes.

Usage

academic_colour_palette(palette = NA, n = NA)

Arguments

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.

Value

A single vector or a list of vectors containing HEX codes for academic colour palettes.

Examples

# Get the colour palette used by the UKRI
academic_colour_palette("ukri_mrc")

Get The Academic Colour Palette Names

Description

Get The Academic Colour Palette Names

Usage

academic_colour_palette_names()

Value

A vector of the names of the colour palettes available in AcademicThemes.

Examples

academic_colour_palette_names()

Scale Plot Colours With Academic Themes (Continuous)

Description

Scale Plot Colours With Academic Themes (Continuous)

Usage

scale_colour_academic_c(palette_name, ...)

Arguments

palette_name

The name of a colour palette in AcademicThemes.

...

Arguments passed to ggplot2::scale_colour_gradientn()

Value

A layer that can be added to a ggplot2 object.

Examples

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)

Description

Scale Plot Colours With Academic Themes (Discrete)

Usage

scale_colour_academic_d(palette_name, ...)

Arguments

palette_name

The name of a colour palette in AcademicThemes.

...

Arguments passed to ggplot2::discrete_scale().

Value

A layer that can be added to a ggplot2 object.

Examples

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)

Description

Scale Plot Fills With Academic Themes (Continuous)

Usage

scale_fill_academic_c(palette_name, ...)

Arguments

palette_name

The name of a colour palette in AcademicThemes.

...

Arguments passed to ggplot2::scale_fill_gradientn()

Value

A layer that can be added to a ggplot2 object.

Examples

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)

Description

Scale Plot Fills With Academic Themes (Discrete)

Usage

scale_fill_academic_d(palette_name, ...)

Arguments

palette_name

The name of a colour palette in AcademicThemes.

...

Arguments passed to ggplot2::discrete_scale().

Value

A layer that can be added to a ggplot2 object.

Examples

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"
  )