This is a direct replication of the code from Karthik Ram's wesanderson
palette and David Miller's beyonce
palette
But, I generated Colour Palettes using the wonderful and inspirational palettes from colorlisa.com
devtools::install_github("skiptoniam/artists")
library(artists)
Here is a complete list of artworks and their colour palettes.
par(mfrow=c(26,5)) for(i in 1:128) print(artist_palette(i))
My only slight tweek is an abilitiy to view the art work your colour palette is based on.
This can be achieved by setting see_painting = TRUE
This is one of my favorites
par(mfrow=c(2,1)) artist_palette(1,see_painting = TRUE) library(jpeg) jj <- readJPEG('./a.jpg',native=TRUE) plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE) rasterImage(jj,0,0,1,1)
library(ggplot2) df <- data.frame( x = runif(100), y = runif(100), z1 = rnorm(100), z2 = abs(rnorm(100)) ) ggplot(df, aes(x, y)) + geom_point(aes(colour = z1,size=z2)) + scale_colour_gradientn(colours = artist_palette(1,100,type ='continuous'))
I also really like this one too. Which seems to make nice plots.
par(mfrow=c(2,1)) artist_palette(3) library(jpeg) jj <- readJPEG('./b.jpg',native=TRUE) plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE) rasterImage(jj,0,0,1,1)
Here is an example of using this colour palette in ggplot
.
library(ggplot2) ggplot(diamonds, aes(x = price, fill = cut)) + geom_histogram(position = "dodge", binwidth = 1000)+ scale_fill_manual(values = artist_palette(3))
Bauhaus Stairway by Oskar Schlemmer is awesome for heat maps.
par(mfrow=c(1,2)) artist_palette(104) library(jpeg) jj <- readJPEG('./c.jpg',native=TRUE) plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE) rasterImage(jj,0,0,1,1)
Here is an example using the old faithful dataset.
cols <- artist_palette(104,100,type ='continuous') ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density))+ scale_fill_gradientn(colours = cols)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.