Skip to contents

Returns colour schemes based on user input. Used to provide default colour schemes for simple cases.

Usage

default.colours(
  number.of.colours = 2,
  palette.type = 'qual',
  is.greyscale = TRUE,
  is.venn = FALSE
  );

Arguments

number.of.colours

The number of colours requested for the colour scheme.

palette.type

The type of colour scheme requested. Only palette types of “seq”, “div”, “qual”, “pastel”, “survival”, “dotmap”, “spiral.sunrise”, “spiral.morning”, “spiral.dusk”, “spiral.noon”, “spiral.afternoon”, “spiral.dawn”, and “spiral.night” are accepted. Legacy colour palettes are available under “chromosomes”, “old.qual1”, “old.qual2”, “old.seq”, and “old.div”. “seq” corresponds to sequential colour schemes, “div” corresponds to diverging colour schemes, and “qual” corresponds to qualitative colour schemes - “pastel” is a pastel version of this palette. “survival” is useful for survival plots, as the first two colour are blue and red, following convention. The remaining colour schemes are not tied to a specific use-case.

is.greyscale

Boolean asking whether or the colour scheme should be greyscale-compatible. Defaults to TRUE. The purpose of this parameter is to warn users if they ask for a colour scheme that is not greyscale-compatible. Regardless of the value of is.greyscale, the same colour scheme will be provided.

is.venn

Boolean determining whether or not the colour scheme is to be used for a venn diagram. If TRUE, the palette type should be set to NULL. For venn diagrams, text colours are also provided.

Details

For further information on colour schemes, refer to the plotting guide.)

Author

Christine P'ng

Examples


default.colours(number.of.colours = 6, is.greyscale = FALSE, palette.type = 'div')
#> [1] "#B32B2B" "#DD4E4E" "#EB7C7C" "#F7BEBE" "#BEF4F7" "#80CDD1"
# Returns:
# [1] "#B32B2B" "#DD4E4E" "#EB7C7C" "#F7BEBE" "#BEF4F7" "#80CDD1"

default.colours(number.of.colours = 3, palette.type = NULL, is.venn = TRUE)
#> [[1]]
#> [1] "red"        "dodgerblue" "yellow"    
#> 
#> [[2]]
#> [1] "darkred"    "darkblue"   "darkorange"
#> 
# Returns:
# [1] "red"        "dodgerblue" "yellow"    
# [1] "darkred"    "darkblue"   "darkorange"
# The second line of colours is the corresponding text colour

default.colours(number.of.colours = c('2','5','3'), c('binary','seq','seq'))
#> Warning: Colour scheme may not be greyscale compatible.
#> [[1]]
#> [1] "white" "black"
#> 
#> [[2]]
#> [1] "mintcream"     "darkseagreen1" "lightgreen"    "springgreen3" 
#> [5] "springgreen4" 
#> 
#> [[3]]
#> [1] "lightcyan"     "paleturquoise" "turquoise1"   
#> 
# Returns:
# [[1]]
# [1] "white"       "chartreuse3"

# [[2]]
# [1] "lavenderblush"  "pink"           "palevioletred1" "violetred1"    
# [5] "maroon"        

# [[3]]
# [1] "aliceblue"    "lightblue1"   "lightskyblue"

default.colours(5, 'spiral.sunrise');
#> Warning: Colour scheme may not be greyscale compatible.
#> [1] "#336A90" "#65B4A2" "#B1D39A" "#F4E0A6" "#FFE1EE"
# Returns: 
# [1] "#336A90" "#65B4A2" "#B1D39A" "#F4E0A6" "#FFE1EE"