Generate a color palette (continuous or discrete) following the editorial guidelines used by the Institute for Applied Economic Research - Ipea.
Usage
scale_color_ipea(
palette = c("Blue", "Green", "Orange", "Pink", "Green-Blue", "Green-Blue-White",
"Red-Blue", "Red-Blue-White", "Orange-Blue", "Orange-Blue-White", "Viridis",
"Inferno", "Magma", "Plasma", "Cividis"),
palette_direction = 1,
decimal.mark = ",",
barheight = NULL,
barwidth = NULL,
title.hjust = NULL,
label.hjust = NULL,
...
)
Arguments
- palette
A character vector specifying the available palette for the color palette. The default palette are
"Blue"
, but we can also change to'Green'
,'Orange'
,'Pink'
,'Red-Blue'
,'Orange-Blue'
,'Green-Blue'
,'Red-Blue-White'
,'Orange-Blue-White'
,'Green-Blue-White'
,'Viridis'
,'Inferno'
,'Magma'
,'Plasma'
,'Cividis'
.- palette_direction
A logical argument specifying if the ordering of the colors will follow the default of the palette (when the argument is 1) or if it will have an inverted ordering (for cases where it is -1).
- decimal.mark
The character to be used to indicate the numeric decimal point and Character used between every 3 digits to separate thousands. By default, the function uses a comma
","
, following the format used in Brazilian Portuguese.- barheight
The height of the color gradient bar. This parameter is used when the direction is set to "horizontal".
- barwidth
The width of the color gradient bar. This parameter is used when the direction is set to "horizontal".
- title.hjust
A number specifying horizontal justification of the title text.
- label.hjust
A number specifying vertical justification of the title text.
- ...
Additional arguments to be passed to the scale_fill_gradientn, scale_color_gradientn, scale_fill_distiller or scale_color_distiller function from the ggplot2 package.
See also
Other ggplot2 theme functions:
scale_fill_ipea()
,
theme_ipea()
Examples
# Creating scale for ggplot2 graph using default arguments
library(ggplot2)
fig_raw <- ggplot() +
geom_point(data = mtcars, aes(x = hp , y = mpg, color = cyl)) +
scale_color_ipea()
# Creating scale for ggplot2 graph using green sequential palette
fig_raw <- ggplot() +
geom_point(data = mtcars, aes(x = hp , y = mpg, color = cyl)) +
scale_color_ipea(palette = "Green")