scale_fill_conesa {RColorConesa}R Documentation

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 conesa_palettes. Available options include: "main", "nature", "sunshine", "hot", "warm", "cold", and "complete" (Default: "main").

continuous

A logical value indicating whether the color aesthetic represents continuous data (Default: FALSE).

reverse

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

...

Additional arguments passed either to discrete_scale or scale_fill_gradientn from the ggplot2 package, depending on the value of the continuous parameter.

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")


[Package RColorConesa version 1.0.0 Index]