| Title: | Conesa Colors Palette |
| Version: | 1.0.0 |
| Maintainer: | Pedro Salguero Garcia <pedrosalguerog@gmail.com> |
| Description: | Provides a collection of palettes designed to integrate with 'ggplot', reflecting the color schemes associated with 'ConesaLab'. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| Imports: | ggplot2 |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2023-09-12 08:37:20 UTC; Ps |
| Author: | Pedro Salguero Garcia
|
| Repository: | CRAN |
| Date/Publication: | 2023-09-12 20:30:09 UTC |
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")
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: |
palette |
A character string specifying the name of the desired palette from the |
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.
Value
A character vector of colors corresponding to the specified number and palette.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Examples
library(ggplot2)
data("iris")
colorSpecies <- colorConesa(3, palette = "cold")
plot(x = iris$Sepal.Length, y = iris$Sepal.Width, col = colorSpecies[iris$Species], pch = 16)
Function to extract conesa colors as hex codes
Description
Function to extract conesa colors as hex codes
Usage
conesa_cols(...)
Arguments
... |
Character names of conesa_colors |
Interpolate a Conesa Color Palette
Description
The conesa_pal function offers a flexible way to interpolate colors from the Conesa color palettes. This function provides an interface to generate a range of colors based on the selected Conesa palette, allowing for enhanced customization in scientific visualizations.
Usage
conesa_pal(palette = "main", reverse = FALSE, ...)
Arguments
palette |
A character string specifying the name of the desired palette from the |
reverse |
A logical value indicating whether the colors in the selected palette should be reversed. Default is |
... |
Additional arguments to be passed to the |
Details
The Conesa color palettes, available in the RColorConesa package, have been specifically curated for scientific visualizations. The conesa_pal function leverages the colorRampPalette function from the grDevices package to interpolate between the colors of the chosen Conesa palette. This interpolation capability ensures that users can generate a continuous range of colors, suitable for representing a wide variety of data types and scales. Whether visualizing continuous data gradients or categorical distinctions, the interpolated Conesa palettes can provide clarity and aesthetic appeal to the visual representation.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Conesa color palette
Description
Conesa color palette
Usage
conesa_palettes
Format
An object of class list of length 7.
Retrieve Conesa's Main Color Set
Description
The getConesaColors function provides access to a curated set of colors that are part of the RColorConesa package. These colors have been specifically chosen for their utility in scientific visualizations.
Usage
getConesaColors()
Details
When using the getConesaColors function, users can seamlessly integrate these colors into their R visualizations, benefiting from the expertise embedded in the Conesa color selection.
Value
A list containing the primary colors from the Conesa collection. Each color in the list is represented as a hexadecimal color value.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Examples
getConesaColors()
Return Conesa Color Palettes
Description
The getConesaPalettes function retrieves a collection of color palettes, specifically designed for scientific visualizations. These palettes are part of the Conesa collection.
Usage
getConesaPalettes()
Details
By using the getConesaPalettes function, users can access these palettes and incorporate them into their visualizations, ensuring that their plots and graphs are both informative and visually appealing.
Value
A list containing the various color palettes from the Conesa collection. Each palette in the list is represented as a vector of color values.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Examples
getConesaPalettes()
Color scale constructor for conesa colors
Description
The scale_color_conesa function provides a mechanism to integrate ConesaLab's curated color palettes into ggplot2 visualizations.
Usage
scale_color_conesa(palette = "main", continuous = FALSE, reverse = FALSE, ...)
Arguments
palette |
A character string specifying the name of the desired palette from the |
continuous |
A logical value indicating whether the color aesthetic represents continuous data (Default: |
reverse |
A logical value indicating whether the colors in the selected palette should be reversed (Default: |
... |
Additional arguments passed either to |
Details
The scale_color_conesa function acts as a bridge between these palettes and the ggplot2 package, allowing users to apply the palettes to their plots Depending on the nature of the data (continuous or discrete), the function intelligently selects the appropriate scale from ggplot2 to render the colors.
When the continuous parameter is set to TRUE, the function employs the scale_color_gradientn function from ggplot2 to generate a continuous color scale. Conversely, for discrete data, the discrete_scale function is utilized. This ensures that the chosen palette is optimally represented in the plot, irrespective of the data type.
Value
A ggplot2 scale function suitable for adding to a ggplot2 object.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Examples
library(ggplot2)
data("iris")
g <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species))
g <- g + geom_point(size = 4)
g <- g + scale_color_conesa(palette = "main")
Fill scale constructor for conesa colors
Description
The scale_fill_conesa function provides a mechanism to integrate ConesaLab's curated color palettes into ggplot2 visualizations.
Usage
scale_fill_conesa(palette = "main", continuous = FALSE, reverse = FALSE, ...)
Arguments
palette |
A character string specifying the name of the desired palette from the |
continuous |
A logical value indicating whether the color aesthetic represents continuous data (Default: |
reverse |
A logical value indicating whether the colors in the selected palette should be reversed (Default: |
... |
Additional arguments passed either to |
Details
The scale_fill_conesa function acts as a bridge between these palettes and the ggplot2 package, allowing users to apply the palettes to their plots Depending on the nature of the data (continuous or discrete), the function intelligently selects the appropriate scale from ggplot2 to render the colors.
When the continuous parameter is set to TRUE, the function employs the scale_fill_gradientn function from ggplot2 to generate a continuous color scale. Conversely, for discrete data, the discrete_scale function is utilized. This ensures that the chosen palette is optimally represented in the plot, irrespective of the data type.
Value
A ggplot2 scale function suitable for adding to a ggplot2 object.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
Examples
library(ggplot2)
data("iris")
g <- ggplot(iris, aes(x = Sepal.Width, fill = Species))
g <- g + geom_histogram(binwidth = 0.2, alpha = 0.8)
g <- g + labs(title = "Histogram of Sepal Width", x = "Sepal Width", y = "Frequency")
g <- g + scale_fill_conesa(palette = "main")