Learn R Programming

RColorConesa (version 1.0.0)

colorConesa: Retrieve Colors from ConesaLab's Palettes

Description

The colorConesa function facilitates the extraction of a specified number of colors from the ConesaLab's curated color palettes. This function is designed to obtain a set of colors for their scientific visualizations.

Usage

colorConesa(n, reverse = FALSE, palette = "complete")

Value

A character vector of colors corresponding to the specified number and palette.

Arguments

n

An integer specifying the number of colors to be extracted from the chosen palette.

reverse

A logical value indicating whether the colors in the selected palette should be reversed (Default: FALSE).

palette

A character string specifying the name of the desired palette from the conesa_palettes. Available options include: "main", "nature", "sunshine", "hot", "warm", "cold", and "complete" (Default: "complete").

Author

Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es

Details

ConesaLab's color palettes, available within the package, are tailored for scientific data visualization. The colorConesa function is built upon these palettes, offering flexibility in color selection based on the user's requirements. It integrates with the palette argument to choose the color thematic.

It's essential to note that if the requested number of colors (n) is less than or equal to the size of the chosen palette, the function will directly extract the colors without interpolation. However, if n surpasses the palette size, interpolation is employed to generate the required colors.

Examples

Run this code
library(ggplot2)
data("iris")
colorSpecies <- colorConesa(3, palette = "cold")
plot(x = iris$Sepal.Length, y = iris$Sepal.Width, col = colorSpecies[iris$Species], pch = 16)

Run the code above in your browser using DataLab