knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "fig/README-", echo = TRUE, fig.height = 1, fig.width = 6 )
library(devtools) install_github("alburezg/suffrager")
library(suffrager)
See all available palettes:
names(suf_palettes)
{width=600px}
# Discrete suf_palette("london")
library(ggplot2) data(airquality) ggplot(airquality, aes(x=Day, y=Month)) + geom_tile(aes(fill=Temp)) + scale_fill_gradientn(colours = rev(suf_palette("london", 30, type = "continuous"))) + coord_equal()
{width=600px}
# Discrete suf_palette("oxon")
data(diamonds) ggplot(diamonds, aes(x=carat, y=price, colour=cut)) + geom_point() + scale_colour_manual(values = suf_palette("oxon"))
{width=600px}
# Discrete suf_palette("CarolMan")
data(iris) ggplot(iris,aes(x = Petal.Length, fill = Species)) + geom_density() + scale_color_manual(values = suf_palette("CarolMan"))
{width=600px}
# Discrete suf_palette("hanwell")
data(diamonds) ggplot(diamonds, aes(x = carat, fill = cut)) + geom_histogram(bins = 20) + scale_fill_manual(values = rev(suf_palette("hanwell")))
{width=600px}
# Discrete suf_palette("chelsea")
data("airquality") ggplot(airquality, aes(x = factor(Month), y = Ozone, fill = factor(Month))) + geom_violin() + scale_fill_manual(values = suf_palette("chelsea"))
{width=600px}
# Discrete suf_palette("classic")
data(iris) ggplot(iris,aes(x = Petal.Length, y = Petal.Width, color = Species)) + geom_point() + geom_smooth(method = 'loess') + facet_grid(. ~ Species, scales = 'free') + scale_color_manual(values = suf_palette("classic", n = 3, type = "continuous"))
Create a continuous palette of length n
based on the suffragette colours:
# Continuous suf_palette("classic", n = 6, type = "continuous")
Developed by Diego Alburez-Gutierrez and Valentina Iemmi.
The package's architecture and documentation was taken from Karthik Ram's wesanderson package.
Images for the london
, oxon
, CarolMan
, chelsea
, and classic
palettes used with kind permission from the LSE Womens Library Collection.
Images for palette hanwell
were provided by the 100 Banners project and are used with the project's consent. The banners for the chelsea
pallete come from the collections of the Museum of London, as well as the rosette used for the classic
palette.
Want to help? Create a pull request or share the word: @d_alburez @ValentinaIemmi!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.