Function for using RioPalettes colors schemes in ggplot2
. Use
scale_color_rio_d()
and scale_fill_rio_d()
for discrete scales and
scale_color_rio_c()
and scale_fill_rio_c()
for continuous scales.
Arguments
- palette_name
Name of Palette. Choices are:
Beija_Flor
,Grande_Rio
,Imperatriz_Leopoldinense
,Imperio_Serrano
,Mangueira
,Padre_Miguel
,Paraiso_Tuiuti
,Portela
,Salgueiro
,Sao_Clemente
,Tijuca
,Uniao_Ilha
,Vila_Isabel
,Viradouro
.- direction
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed
- override.order
Colors are picked from palette to maximize readability. This means that colors are not always selected in sequential order from the full palette. If override.order is set to TRUE, colors are selected in sequential order from the full palette instead. Default is FALSE.
- ...
Other arguments passed on to
ggplot2::discrete_scale()
Examples
# Gets the scores of Mangueira from 1968 until 2018 on the Bateria criterion.
# Throws some warnings to inform the user which years are absent of the data
# (either from missing info or because the school didn't compete in the main league)
df <- get_scores(years = 1968:2018,
schools = "Estação primeira de Mangueira",
criterions = "BATERIA")
#> Warning: Your selection does not contains: 1982, 1983, 1984
# Loads ggplot2 and dplyr
library(ggplot2)
library(dplyr)
# Creates a plot and applies the palette of Mangueira
df |>
mutate(era = case_when(
between(year, 1968, 1984) ~ "1968-1984",
between(year, 1985, 2001) ~ "1985-2001",
between(year, 2002, 2018) ~ "2002-2018"
)) |>
ggplot(aes(x = era, y = score, color = era)) +
geom_jitter() +
scale_color_rio_d("Mangueira")