Title: | Colour Palettes Based on the Scientific Colour-Maps |
Version: | 1.5.0 |
Maintainer: | Thomas Lin Pedersen <thomasp85@gmail.com> |
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. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
Depends: | R (≥ 2.10) |
Imports: | scales, grDevices |
Suggests: | ggplot2, testthat, dplyr, covr |
URL: | https://github.com/thomasp85/scico |
BugReports: | https://github.com/thomasp85/scico/issues |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-08-14 12:51:20 UTC; thomas |
Author: | Thomas Lin Pedersen
|
Repository: | CRAN |
Date/Publication: | 2023-08-14 13:10:02 UTC |
scico: 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.
Author(s)
Maintainer: Thomas Lin Pedersen thomasp85@gmail.com (ORCID)
Authors:
Fabio Crameri
See Also
Useful links:
Scales to use for ggplot2
Description
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.
Usage
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
... |
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"). |
Value
A ScaleContinuous
or ScaleDiscrete
object that can be added to a
ggplot
object
Examples
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()
}
Scientific colour map palettes
Description
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.
Usage
scico(
n,
alpha = NULL,
begin = 0,
end = 1,
direction = 1,
palette = "bilbao",
categorical = FALSE
)
Arguments
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 |
Value
A character vector of length n
with hexencoded rgb(a) colour values
References
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
Examples
# 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')
Access raw palette data
Description
These functions gives access to the data underlying the palettes
Usage
scico_palette_names(categorical = FALSE)
scico_palette_data(palette, categorical = FALSE)
Arguments
categorical |
Boolean. Should the categorical palettes be returned |
palette |
The name of the palette to fetch data for |
Show the different scico palettes
Description
This is a simple function to show a gradient of the different palettes
available in the scico
package
Usage
scico_palette_show(
palettes = scico_palette_names(categorical),
categorical = FALSE,
n = if (categorical) 6 else 100
)
Arguments
palettes |
One or more palette names to show |
categorical |
Boolean. Should the categorical palettes be returned |
n |
How many colours should be shown |
Examples
scico_palette_show()
scico_palette_show(categorical = TRUE)