| scale_color_conesa {RColorConesa} | R Documentation |
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")