Title: | 'CARTOColors' Palettes |
---|---|
Description: | Provides color schemes for maps and other graphics designed by 'CARTO' as described at <https://carto.com/carto-colors/>. It includes four types of palettes: aggregation, diverging, qualitative, and quantitative. |
Authors: | Jakub Nowosad [aut, cre] |
Maintainer: | Jakub Nowosad <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.1.2 |
Built: | 2024-11-09 05:54:17 UTC |
Source: | https://github.com/nowosad/rcartocolor |
Creates a color palette from CARTOcolor
carto_pal(n = NULL, name, ...)
carto_pal(n = NULL, name, ...)
n |
Number of different colors in the palette, minimum depending on palette (2 or 3), maximum depending on palette (7 or 11) |
name |
A palette name |
... |
Additional arguments for grDevices::colorRampPalette |
A character vector
my_colors1 = carto_pal(7, "Burg") my_colors1 my_colors2 = carto_pal(17, "Burg") my_colors2 my_colors3 = carto_pal(17, "Safe") my_colors3
my_colors1 = carto_pal(7, "Burg") my_colors1 my_colors2 = carto_pal(17, "Burg") my_colors2 my_colors3 = carto_pal(17, "Safe") my_colors3
A dataset containing the information about the CARTOcolor palettes. Source: https://github.com/CartoDB/CartoColor/blob/master/cartocolor.js.
cartocolors
cartocolors
A data frame with 32 rows and 12 variables:
Name: palette name
Type: palette type
n2 to n11: list of the color values depending on the number of colors used (between two and twelve)
Displays a set of the color palettes from CARTOcolor
display_carto_all(n = NULL, type = "all", colorblind_friendly = NULL)
display_carto_all(n = NULL, type = "all", colorblind_friendly = NULL)
n |
Number of different colors in the palette, minimum depending on the palette (2 or 3), maximum depending on the palette (7 or 11) |
type |
Type of the palette, can be "quantitative", "diverging", "qualitative", "aggregation", or "all" |
colorblind_friendly |
if TRUE, display only colorblind friendly palettes |
display_carto_all() display_carto_all(type = "quantitative") display_carto_all(type = c("diverging", "qualitative", "aggregation")) display_carto_all(3, type = "quantitative") display_carto_all(7, type = "quantitative") display_carto_all(7, colorblind_friendly = TRUE) display_carto_all(7, type = c("diverging", "qualitative", "aggregation"), colorblind_friendly = TRUE)
display_carto_all() display_carto_all(type = "quantitative") display_carto_all(type = c("diverging", "qualitative", "aggregation")) display_carto_all(3, type = "quantitative") display_carto_all(7, type = "quantitative") display_carto_all(7, colorblind_friendly = TRUE) display_carto_all(7, type = c("diverging", "qualitative", "aggregation"), colorblind_friendly = TRUE)
Displays a color palette from CARTOcolor
display_carto_pal(n = NULL, name)
display_carto_pal(n = NULL, name)
n |
Number of different colors in the palette, minimum depending on palette (2 or 3), maximum depending on palette (7 or 11) |
name |
A palette name |
display_carto_pal(7, "Burg")
display_carto_pal(7, "Burg")
A dataset containing the information about the CARTOcolor palettes. Source: https://github.com/CartoDB/CartoColor/blob/master/cartocolor.js.
metacartocolors
metacartocolors
A data frame with 32 rows and 12 variables:
Name: palette name
Type: palette type
Min_n: minimal number of colors in a given palette
Max_n: maximal number of colors in a given palette
Colorblind_friendly: is the palette colorblind friendly?
CARTO color scales
scale_color_carto_c( ..., type = "quantitative", palette = 1, direction = 1, na.value = "#e9e9e9", guide = "colourbar" ) scale_color_carto_d( ..., type = "qualitative", palette = 1, direction = 1, na.value = "#e9e9e9" ) scale_colour_carto_c( ..., type = "quantitative", palette = 1, direction = 1, na.value = "#e9e9e9", guide = "colourbar" ) scale_colour_carto_d( ..., type = "qualitative", palette = 1, direction = 1, na.value = "#e9e9e9" ) scale_fill_carto_c( ..., type = "quantitative", palette = 1, direction = 1, na.value = "#e9e9e9", guide = "colourbar" ) scale_fill_carto_d( ..., type = "qualitative", palette = 1, direction = 1, na.value = "#e9e9e9" )
scale_color_carto_c( ..., type = "quantitative", palette = 1, direction = 1, na.value = "#e9e9e9", guide = "colourbar" ) scale_color_carto_d( ..., type = "qualitative", palette = 1, direction = 1, na.value = "#e9e9e9" ) scale_colour_carto_c( ..., type = "quantitative", palette = 1, direction = 1, na.value = "#e9e9e9", guide = "colourbar" ) scale_colour_carto_d( ..., type = "qualitative", palette = 1, direction = 1, na.value = "#e9e9e9" ) scale_fill_carto_c( ..., type = "quantitative", palette = 1, direction = 1, na.value = "#e9e9e9", guide = "colourbar" ) scale_fill_carto_d( ..., type = "qualitative", palette = 1, direction = 1, na.value = "#e9e9e9" )
... |
Other arguments passed on to |
type |
One of \"aggregation\", \"diverging\", \"qualitative\", or \"quantitative\" |
palette |
If a string, will use that named palette. If a number, will
index into the list of palettes of appropriate |
direction |
Sets the order of colors in the scale. If 1, the default,
colors are as output by |
na.value |
Missing values will be replaced with this value. |
guide |
A function used to create a guide or its name. See
|
library(ggplot2) ggplot(msleep, aes(vore, sleep_total, fill = vore)) + geom_boxplot() + scale_fill_carto_d(palette = 6, direction = -1) ## Not run: library(sf) library(spData) library(ggplot2) ggplot(world, aes(fill = lifeExp)) + geom_sf(data = world) + coord_sf(crs = "+proj=robin") + scale_fill_carto_c(name = "Life expectancy: ", type = "diverging", palette = "Earth", direction = -1) + theme_void() ggplot(world, aes(fill = region_un)) + geom_sf(data = world) + coord_sf(crs = "+proj=robin") + scale_fill_carto_d(name = "Region: ", palette = "Safe") + theme_void() ## End(Not run)
library(ggplot2) ggplot(msleep, aes(vore, sleep_total, fill = vore)) + geom_boxplot() + scale_fill_carto_d(palette = 6, direction = -1) ## Not run: library(sf) library(spData) library(ggplot2) ggplot(world, aes(fill = lifeExp)) + geom_sf(data = world) + coord_sf(crs = "+proj=robin") + scale_fill_carto_c(name = "Life expectancy: ", type = "diverging", palette = "Earth", direction = -1) + theme_void() ggplot(world, aes(fill = region_un)) + geom_sf(data = world) + coord_sf(crs = "+proj=robin") + scale_fill_carto_d(name = "Region: ", palette = "Safe") + theme_void() ## End(Not run)