Title: | Color Palettes Inspired by Works of Mexican Painters and Muralists |
---|---|
Description: | Color palettes inspired by the works of Mexican painters and muralists. The package includes functions that return vectors of colors and also functions to use color and fill scales in 'ggplot2' visualizations. |
Authors: | Antonio Páez [aut, cre] |
Maintainer: | Antonio Páez <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.2 |
Built: | 2025-02-13 02:55:54 UTC |
Source: | https://github.com/paezha/mexbrewer |
A data.frame containing population estimates for all the Mexican states in 2020
df_mxstate_2020
df_mxstate_2020
An object of class data.frame
with 32 rows and 11 columns.
INEGI code of the state
short state name (e.g. Coahuila)
Official state name (e.g. Coahuila de Zaragoza)
state abbreviation
official state abbreviation (it can be awkward to use Chis for Chiapas) according to the INEGI.
2015, the year of the Conteo from which the data is sourced
total state population according to the Censo 2020
male population according to the Censo 2020
female population according to the Censo 2020
afromexican population according to the Censo 2020
Number of persons who speak an indigenous language according to the Censo 2020
A data.frame
Population estimates taken from the Censo 2020.
data("df_mxstate_2020") head(df_mxstate_2020)
data("df_mxstate_2020") head(df_mxstate_2020)
Functions scale_color_mex_c
and scale_fill_mex_c
for continuous scales enable the use of MexBrewer
colors with ggplot2
continuous scales.
scale_color_mex_c(palette_name, direction = 1, ...) scale_colour_mex_c(palette_name, direction = 1, ...) scale_fill_mex_c(palette_name, direction = 1, ...)
scale_color_mex_c(palette_name, direction = 1, ...) scale_colour_mex_c(palette_name, direction = 1, ...) scale_fill_mex_c(palette_name, direction = 1, ...)
palette_name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
... |
Other arguments passed on to |
A ScaleContinuous
object that can be added to a ggplot
object
Other color scales:
ggplot2-scales-discrete
Functions scale_color_mex_d
and scale_fill_mex_d
enable the use of MexBrewer
colors with ggplot2
discrete scales.
scale_color_mex_d(palette_name, direction = 1, override.order = FALSE, ...) scale_colour_mex_d(palette_name, direction = 1, override.order = FALSE, ...) scale_fill_mex_d(palette_name, direction = 1, override.order = FALSE, ...)
scale_color_mex_d(palette_name, direction = 1, override.order = FALSE, ...) scale_colour_mex_d(palette_name, direction = 1, override.order = FALSE, ...) scale_fill_mex_d(palette_name, direction = 1, override.order = FALSE, ...)
palette_name |
Name of Palette. Choices are:
|
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 and aesthetics. 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 |
A ScaleDiscrete
object that can be added to a ggplot
object
Other color scales:
ggplot2-scales-continuous
library(ggplot2) ggplot(data=iris, aes(x=Species, y=Sepal.Length, fill=Species)) + geom_violin() + scale_fill_mex_d("Aurora")
library(ggplot2) ggplot(data=iris, aes(x=Species, y=Sepal.Length, fill=Species)) + geom_violin() + scale_fill_mex_d("Aurora")
These are a handful of color palettes from Mexican muralists. Complete list of palette colors and the works that inspired them can be found here.
mex.brewer( palette_name, n, type = c("discrete", "continuous"), direction = c(1, -1), override.order = FALSE )
mex.brewer( palette_name, n, type = c("discrete", "continuous"), direction = c(1, -1), override.order = FALSE )
palette_name |
Name of Palette. Choices are:
|
n |
Number of desired colors. If number of requested colors is beyond the scope of the palette, colors are automatically interpolated. If n is not provided, the length of the palette is used. |
type |
Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colors. |
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 and aesthetics. 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. |
A vector of colors for use in visualization tasks
mex.brewer("Atentado") mex.brewer("Concha", 6) mex.brewer("Frida", 10, "continuous")
mex.brewer("Atentado") mex.brewer("Concha", 6) mex.brewer("Frida", 10, "continuous")
Use names(MexPalettes) to return all possible palette names. Current choices are:
Alacena
, Atentado
, Aurora
, Casita1
, Casita2
, Casita3
, Concha
, Frida
, Huida
, Maiz
, Naturaleza
, Ofrenda
,
Revolucion
, Ronda
, Taurus1
, Taurus2
,Tierra
, Vendedora
.
Use mex.brewer
to construct palettes.
MexPalettes
MexPalettes
An object of class list
of length 18.
A simple features object with the boundaries of states in Mexico (unprojected; CRS is WGS 84).
data(mx_estados)
data(mx_estados)
A simple features data frame with 32 rows and 4 variables:
Unique identifier of polygon
Name of the state
Geographical region of the state; there are five regions in the country
Geometry information of the polygons
A simple features data frame
data(mx_estados) summary(mx_estados)
data(mx_estados) summary(mx_estados)
Use mex.brewer
to construct palettes.
sequential_palettes
sequential_palettes
An object of class character
of length 7.
Checks whether a palette is Sequential.
sequential.palette(palette_name)
sequential.palette(palette_name)
palette_name |
Name of Palette. Choices are:
|
TRUE/FALSE if palette is sequential
sequential.palette("Aurora")
sequential.palette("Aurora")