Title: | Conesa Colors Palette |
---|---|
Description: | Provides a collection of palettes designed to integrate with 'ggplot', reflecting the color schemes associated with 'ConesaLab'. |
Authors: | Pedro Salguero Garcia [aut, cre] |
Maintainer: | Pedro Salguero Garcia <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-10-31 16:33:41 UTC |
Source: | https://github.com/cran/RColorConesa |
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.
colorConesa(n, reverse = FALSE, palette = "complete")
colorConesa(n, reverse = FALSE, palette = "complete")
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 |
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.
A character vector of colors corresponding to the specified number and palette.
Pedro Salguero Garcia. Maintainer: [email protected]
library(ggplot2) data("iris") colorSpecies <- colorConesa(3, palette = "cold") plot(x = iris$Sepal.Length, y = iris$Sepal.Width, col = colorSpecies[iris$Species], pch = 16)
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
conesa_cols(...)
conesa_cols(...)
... |
Character names of conesa_colors |
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.
conesa_pal(palette = "main", reverse = FALSE, ...)
conesa_pal(palette = "main", reverse = FALSE, ...)
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 |
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.
Pedro Salguero Garcia. Maintainer: [email protected]
Conesa color palette
conesa_palettes
conesa_palettes
An object of class list
of length 7.
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.
getConesaColors()
getConesaColors()
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.
A list containing the primary colors from the Conesa collection. Each color in the list is represented as a hexadecimal color value.
Pedro Salguero Garcia. Maintainer: [email protected]
getConesaColors()
getConesaColors()
The getConesaPalettes
function retrieves a collection of color palettes, specifically designed for scientific visualizations. These palettes are part of the Conesa collection.
getConesaPalettes()
getConesaPalettes()
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.
A list containing the various color palettes from the Conesa collection. Each palette in the list is represented as a vector of color values.
Pedro Salguero Garcia. Maintainer: [email protected]
getConesaPalettes()
getConesaPalettes()
The scale_color_conesa
function provides a mechanism to integrate ConesaLab's curated color palettes into ggplot2
visualizations.
scale_color_conesa(palette = "main", continuous = FALSE, reverse = FALSE, ...)
scale_color_conesa(palette = "main", continuous = FALSE, reverse = FALSE, ...)
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 |
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.
A ggplot2
scale function suitable for adding to a ggplot2
object.
Pedro Salguero Garcia. Maintainer: [email protected]
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")
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")
The scale_fill_conesa
function provides a mechanism to integrate ConesaLab's curated color palettes into ggplot2
visualizations.
scale_fill_conesa(palette = "main", continuous = FALSE, reverse = FALSE, ...)
scale_fill_conesa(palette = "main", continuous = FALSE, reverse = FALSE, ...)
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 |
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.
A ggplot2
scale function suitable for adding to a ggplot2
object.
Pedro Salguero Garcia. Maintainer: [email protected]
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")
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")