Package 'MexBrewer'

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

Help Index


Mexican 2020 states dataset

Description

A data.frame containing population estimates for all the Mexican states in 2020

Usage

df_mxstate_2020

Format

An object of class data.frame with 32 rows and 11 columns.

Details

region

INEGI code of the state

state_name

short state name (e.g. Coahuila)

state_name_official

Official state name (e.g. Coahuila de Zaragoza)

state_abbr

state abbreviation

state_abbr_official

official state abbreviation (it can be awkward to use Chis for Chiapas) according to the INEGI.

year

2015, the year of the Conteo from which the data is sourced

pop

total state population according to the Censo 2020

pop_male

male population according to the Censo 2020

pop_female

female population according to the Censo 2020

afromexican

afromexican population according to the Censo 2020

indigenous_language

Number of persons who speak an indigenous language according to the Censo 2020

Value

A data.frame

References

Population estimates taken from the Censo 2020.

Examples

data("df_mxstate_2020")
head(df_mxstate_2020)

Continuous MexBrewer scales for use with ggplot2

Description

Functions scale_color_mex_c and scale_fill_mex_c for continuous scales enable the use of MexBrewer colors with ggplot2 continuous scales.

Usage

scale_color_mex_c(palette_name, direction = 1, ...)

scale_colour_mex_c(palette_name, direction = 1, ...)

scale_fill_mex_c(palette_name, direction = 1, ...)

Arguments

palette_name

Name of Palette. Choices are: Alacena, Atentado, Aurora, Casita1, Casita2, Casita3, Concha, Frida, Huida, Maiz, Naturaleza,Ofrenda, Revolucion, Ronda, Taurus1, Taurus2,Tierra, Vendedora.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

...

Other arguments passed on to scale_color_gradientn

Value

A ScaleContinuous object that can be added to a ggplot object

See Also

Other color scales: ggplot2-scales-discrete


Discrete MexBrewer scales for use with ggplot2

Description

Functions scale_color_mex_d and scale_fill_mex_d enable the use of MexBrewer colors with ggplot2 discrete scales.

Usage

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, ...)

Arguments

palette_name

Name of Palette. Choices are: Alacena, Atentado, Aurora, Casita1, Casita2, Casita3, Concha, Frida, Huida, Maiz, Naturaleza,Ofrenda, Revolucion, Ronda, Taurus1, Taurus2,Tierra, Vendedora.

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 discrete_scale

Value

A ScaleDiscrete object that can be added to a ggplot object

See Also

Other color scales: ggplot2-scales-continuous

Examples

library(ggplot2)
ggplot(data=iris, aes(x=Species, y=Sepal.Length, fill=Species)) +
geom_violin() +
scale_fill_mex_d("Aurora")

Mex Palette Generator

Description

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.

Usage

mex.brewer(
  palette_name,
  n,
  type = c("discrete", "continuous"),
  direction = c(1, -1),
  override.order = FALSE
)

Arguments

palette_name

Name of Palette. Choices are: Alacena, Atentado, Aurora, Casita1, Casita2, Casita3, Concha, Frida, Huida, Maiz, Naturaleza,Ofrenda, Revolucion, Ronda, Taurus1, Taurus2,Tierra, Vendedora.

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.

Value

A vector of colors for use in visualization tasks

Examples

mex.brewer("Atentado")

mex.brewer("Concha", 6)

mex.brewer("Frida", 10, "continuous")

Complete list of palettes

Description

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.

Usage

MexPalettes

Format

An object of class list of length 18.


Mexican states.

Description

A simple features object with the boundaries of states in Mexico (unprojected; CRS is WGS 84).

Usage

data(mx_estados)

Format

A simple features data frame with 32 rows and 4 variables:

ID

Unique identifier of polygon

nombre

Name of the state

region

Geographical region of the state; there are five regions in the country

geometry

Geometry information of the polygons

Value

A simple features data frame

Examples

data(mx_estados)
 summary(mx_estados)

Names of sequential palettes

Description

Use mex.brewer to construct palettes.

Usage

sequential_palettes

Format

An object of class character of length 7.


Sequential Palette Check

Description

Checks whether a palette is Sequential.

Usage

sequential.palette(palette_name)

Arguments

palette_name

Name of Palette. Choices are: Alacena,Atentado, Aurora, Casita1, Casita2, Casita3, Concha, Frida, Huida, Maiz, Naturaleza,Ofrenda, Revolucion, Ronda, Taurus1, Taurus2,Tierra, Vendedora.

Value

TRUE/FALSE if palette is sequential

Examples

sequential.palette("Aurora")