Package 'nestcolor'

Title: Colors for NEST Graphs
Description: Clinical reporting figures require to use consistent colors and configurations. As a part of the Roche open-source clinical reporting project, namely the NEST project, the 'nestcolor' package specifies the color code and default theme with specifying 'ggplot2' theme parameters. Users can easily customize color and theme settings before using the reset of NEST packages to ensure consistent settings in both static and interactive output at the downstream.
Authors: Joe Zhu [aut, cre], Emily de la Rua [aut], F. Hoffmann-La Roche AG [cph, fnd]
Maintainer: Joe Zhu <[email protected]>
License: Apache License 2.0
Version: 0.1.2
Built: 2024-09-22 03:16:06 UTC
Source: https://github.com/insightsengineering/nestcolor

Help Index


Color Palettes Used in NEST

Description

[Stable]

A standardized color palette to be used for all plots within the NEST project.

Usage

color_palette(n = 10, palette = "nest")

Arguments

n

(numeric value)
The number of colors to be returned from the color palettes. Please note the colors will be repeated after a certain numerical limit per palette:

  • nest 96 colors

  • stream 38 colors

  • viridis 49 colors

  • accessible 18 colors

palette

(character value)
The name of a palette supported by this function

  • nest A color palette developed by the NEST team representing colors in the NEST logo.

  • stream A color palette proposed by the stream documentation of stream version 2_05

  • viridis A color palette provided by the viridis::plasma function.

  • accessible A color palette consisting of accessible colors for those with color blindness.

Value

A list of hex color code

Examples

library(grid)

plot_pal <- function(x) {
  grid.newpage()
  pushViewport(plotViewport(rep(1, 4)))
  pushViewport(viewport(layout = grid.layout(1, ncol = length(x))))
  for (i in seq_along(x)) {
    grid.rect(
      gp = gpar(fill = x[i], col = NA),
      vp = viewport(layout.pos.col = i, layout.pos.row = 1)
    )
  }
}

plot_pal(color_palette(n = 10, palette = "nest"))

plot_pal(color_palette(n = 10, palette = "stream"))

plot_pal(color_palette(n = 10, palette = "viridis"))

plot_pal(color_palette(n = 10, palette = "accessible"))

Returns a custom NEST ggplot2 theme

Description

Returns a custom NEST ggplot2 theme

Usage

theme_nest(font_size = 10, ...)

Arguments

font_size

(numeric) font size to be passed to ⁠[ggplot2::element_text()]⁠

...

(list) additional arguments to ⁠[ggplot2::theme()]⁠

Value

Return ggplot theme

Examples

plot <- ggplot2::ggplot(iris, ggplot2::aes(x = Sepal.Length, y = Sepal.Width)) +
  ggplot2::geom_point() +
  theme_nest()