knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
This is a small package to provide access to the colour palettes developed by
Fabio Crameri and published at http://www.fabiocrameri.ch/colourmaps.php. It
uses more or less the same api as
viridis
and provides scales for
ggplot2
without requiring ggplot2
to
be installed.
scico
can be installed from CRAN with install.packages('scico')
. If you want
the development version then install directly from GitHub:
# install.packages("devtools") devtools::install_github("thomasp85/scico")
scico
provides 39 different palettes, all of which are perceptually uniform
and colourblind safe. An overview can be had with the scico_palette_show()
function:
library(scico) scico_palette_show()
Once you've decided on a palette you can generate colour values using the
scico()
function:
scico(30, palette = 'lapaz')
scico
provides relevant scales for use with ggplot2
. It only suggests
ggplot2
in order to stay lightweight, but if ggplot2
is available you'll
have access to the scale_[colour|fill]_scico()
functions:
library(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 = 'davos')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.