Title: | Colour Palettes Based on the Scientific Colour-Maps |
---|---|
Description: | Colour choice in information visualisation is important in order to avoid being mislead by inherent bias in the used colour palette. The 'scico' package provides access to the perceptually uniform and colour-blindness friendly palettes developed by Fabio Crameri and released under the "Scientific Colour-Maps" moniker. The package contains 24 different palettes and includes both diverging and sequential types. |
Authors: | Thomas Lin Pedersen [aut, cre] , Fabio Crameri [aut] |
Maintainer: | Thomas Lin Pedersen <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.5.0.9000 |
Built: | 2024-11-10 04:29:33 UTC |
Source: | https://github.com/thomasp85/scico |
Colour choice in information visualisation is important in order to avoid being mislead by inherent bias in the used colour palette. The 'scico' package provides access to the perceptually uniform and colour-blindness friendly palettes developed by Fabio Crameri and released under the "Scientific Colour-Maps" moniker. The package contains 24 different palettes and includes both diverging and sequential types.
Maintainer: Thomas Lin Pedersen [email protected] (ORCID)
Authors:
Fabio Crameri
Useful links:
These functions provide the option to use the scico palettes along with the
ggplot2
package. It goes without saying that it requires ggplot2
to work.
scale_colour_scico( ..., alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", midpoint = NA ) scale_color_scico( ..., alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", midpoint = NA ) scale_fill_scico( ..., alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", midpoint = NA ) scale_colour_scico_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, palette = "batlow", aesthetics = "colour" ) scale_color_scico_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, palette = "batlow", aesthetics = "colour" ) scale_fill_scico_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, palette = "batlow", aesthetics = "fill" )
scale_colour_scico( ..., alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", midpoint = NA ) scale_color_scico( ..., alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", midpoint = NA ) scale_fill_scico( ..., alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", midpoint = NA ) scale_colour_scico_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, palette = "batlow", aesthetics = "colour" ) scale_color_scico_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, palette = "batlow", aesthetics = "colour" ) scale_fill_scico_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, palette = "batlow", aesthetics = "fill" )
... |
Arguments to pass on to |
alpha |
The opacity of the generated colours. If specified rgba values
will be generated. The default ( |
begin , end
|
The interval within the palette to sample colours from.
Defaults to |
direction |
Either |
palette |
The name of the palette to sample from. See
|
midpoint |
A midpoint to center the scale on, used primarily for diverging and multisequential scales |
aesthetics |
Character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with. This can be useful, for example, to apply colour settings to the colour and fill aesthetics at the same time, via aesthetics = c("colour", "fill"). |
A ScaleContinuous
or ScaleDiscrete
object that can be added to a
ggplot
object
if (require('ggplot2')) { volcano <- data.frame( x = rep(seq_len(ncol(volcano)), each = nrow(volcano)), y = rep(seq_len(nrow(volcano)), ncol(volcano)), height = as.vector(volcano) ) ggplot(volcano, aes(x = x, y = y, fill = height)) + geom_raster() + scale_fill_scico(palette = 'tokyo') ggplot(iris, aes(x=Petal.Width, y=Petal.Length)) + geom_point(aes(color=Species), size=10) + scale_colour_scico_d() }
if (require('ggplot2')) { volcano <- data.frame( x = rep(seq_len(ncol(volcano)), each = nrow(volcano)), y = rep(seq_len(nrow(volcano)), ncol(volcano)), height = as.vector(volcano) ) ggplot(volcano, aes(x = x, y = y, fill = height)) + geom_raster() + scale_fill_scico(palette = 'tokyo') ggplot(iris, aes(x=Petal.Width, y=Petal.Length)) + geom_point(aes(color=Species), size=10) + scale_colour_scico_d() }
This function constructs palettes of the specified size based on the colour
maps developed by Fabio Crameri. It follows the same API style as viridis()
from the viridisLite
package so anyone familiar with this package can
easily adapt to that.
scico( n, alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", categorical = FALSE )
scico( n, alpha = NULL, begin = 0, end = 1, direction = 1, palette = "bilbao", categorical = FALSE )
n |
The number of colours to generate for the palette |
alpha |
The opacity of the generated colours. If specified rgba values
will be generated. The default ( |
begin , end
|
The interval within the palette to sample colours from.
Defaults to |
direction |
Either |
palette |
The name of the palette to sample from. See
|
categorical |
Boolean. Should the categorical palettes be returned |
A character vector of length n
with hexencoded rgb(a) colour values
http://www.fabiocrameri.ch/colourmaps.php
Crameri, Fabio. (2021, September 12). Scientific colour maps (Version 7.0.1). Zenodo. doi:10.5281/zenodo.5501399 Crameri, Fabio. (2018). Geodynamic diagnostics, scientific visualisation and StagLab 3.0. Geosci. Model Dev. Discuss. doi:10.5194/gmd-2017-328
# Use the default palette scico(15) # Flip the direction scico(15, direction = -1) # Take a subset of a palette scico(15, begin = 0.3, end = 0.6, palette = 'berlin')
# Use the default palette scico(15) # Flip the direction scico(15, direction = -1) # Take a subset of a palette scico(15, begin = 0.3, end = 0.6, palette = 'berlin')
This is a simple function to show a gradient of the different palettes
available in the scico
package
scico_palette_show( palettes = scico_palette_names(categorical), categorical = FALSE, n = if (categorical) 6 else 100 )
scico_palette_show( palettes = scico_palette_names(categorical), categorical = FALSE, n = if (categorical) 6 else 100 )
palettes |
One or more palette names to show |
categorical |
Boolean. Should the categorical palettes be returned |
n |
How many colours should be shown |
scico_palette_show() scico_palette_show(categorical = TRUE)
scico_palette_show() scico_palette_show(categorical = TRUE)