do_ColorBlindCheck: Generate colorblind variations of a given color palette.

View source: R/do_ColorBlindCheck.R

do_ColorBlindCheckR Documentation

Generate colorblind variations of a given color palette.

Description

This function generate colorblind variations of a provided color palette in order to check if it is colorblind friendly. Variations are generated using colorspace package.

Usage

do_ColorBlindCheck(
  colors.use,
  flip = FALSE,
  font.size = 14,
  font.type = "sans",
  plot.title.face = "bold",
  plot.subtitle.face = "plain",
  plot.caption.face = "italic",
  axis.title.face = "bold",
  axis.text.face = "plain",
  grid.color = "white",
  border.color = "black",
  axis.text.x.angle = 45
)

Arguments

colors.use

character | One color upon which generate the color scale. Can be a name or a HEX code.

flip

logical | Whether to invert the axis of the displayed plot.

font.size

numeric | Overall font size of the plot. All plot elements will have a size relationship with this font size.

font.type

character | Base font family for the plot. One of:

  • mono: Mono spaced font.

  • serif: Serif font family.

  • sans: Default font family.

grid.color

character | Color of the grid in the plot. In heatmaps, color of the border of the cells.

border.color

character | Color for the border of the heatmap body.

axis.text.x.angle

numeric | Degree to rotate the X labels. One of: 0, 45, 90.

Value

A character vector with the desired color scale.

Examples


  # Check Suggests.
  value <- SCpubr:::check_suggests(function_name = "do_ColorBlindCheck", passive = TRUE)
  
  if (isTRUE(value)){
    # Generate a color wheel based on a single value.
    colors <- c("red", "green", "blue")
    p <- SCpubr::do_ColorBlindCheck(colors.use = colors)
    
  } else if (base::isFALSE(value)){
    message("This function can not be used without its suggested packages.")
    message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
  }


enblacar/SCpubr documentation built on Feb. 16, 2025, 12:40 a.m.