Type Package Package harrypotter September 3, 2018 Title Palettes Generated from All ``Harry Potter'' Movies Version 0.1.0 Maintainer Alejandro Jimenez Rico <aljrico@gmail.com> Description Implementation of the characteristic palette present in all Harry Potter movies. Colours obtained by averaging the mean colour from every scene of each movie and from the main colours of each house of Hogwarts. License MIT + file LICENSE Encoding UTF-8 LazyData TRUE Depends R (>= 2.10) Suggests hexbin (>= 1.27.0), testthat, covr URL https://github.com/aljrico/harrypotter BugReports https://github.com/aljrico/harrypotter/issues Imports ggplot2 (>= 1.0.1), gridextra, MASS RoxygenNote 6.0.1 NeedsCompilation no Author Alejandro Jimenez Rico [aut, cre] Repository CRAN Date/Publication 2018-09-03 12:10:02 UTC R topics documented: hp.map........................................... 2 hpmap............................................ 2 scale_color_hp....................................... 4 Index 7 1
2 hpmap hp.map Original Harry Potter colour map Description A dataset containing the averaged RGB values of each frame from every movie of the Harry Potter saga. Usage hp.map Format A data frame containing all the colours used in the palette: V1: Red value V2: Green value V3: Blue value movie: What refers to the movie of the franchise or the house of Hogwarts. It is intended to be a general option for choosing the specific colour palette. hpmap Harry Potter Colour Map. Description This function creates a vector of n equally spaced colors along the HP colour map created by an average calculated for all the colours present in every frame of the pictures. Usage hpmap(n = 256, alpha = 1, begin = 0, end = 1, direction = 1, movie = NA, house = "hufflepuff") hp(n, alpha = 1, begin = 0, end = 1, direction = 1, movie = NA, house = "hufflepuff") hp_pal(alpha = 1, begin = 0, end = 1, direction = 1, movie = NA, house = "hufflepuff")
hpmap 3 Arguments n alpha begin end direction movie house The number of colors ( 1) to be in the palette. The alpha transparency, a number in [0,1], see argument alpha in hsv. The (corrected) hue in [0,1] at which the hp colormap begins. The (corrected) hue in [0,1] at which the hp colormap ends. Sets the order of colors in the scale. If 1, the default, colors are ordered from darkest to lightest. If -1, the order of colors is reversed. A number indicating the colormap movie to use. Eight movies are available: 1,2,3,4,5,6,7 and 8. It is also accepted to desigate the 8th movie as 7.2 and the 7th movie as 7.1. A character string indicating the colourmap from a house to use. Four houses are available: "Gryffindor", "Slytherin", "Ravenclaw" and "Hufflepuff". Details Here are the color scales:
4 scale_color_hp Value Semi-transparent colors (0 < alpha < 1) are supported only on some devices: see rgb. hp returns a character vector, cv, of color hex codes. This can be used either to create a user-defined color palette for subsequent graphics by palette(cv), a col = specification in graphics functions or in par. hpmap returns a n lines data frame containing the red (R), green (G), blue (B) and alpha (alpha) channels of n equally spaced colors along the Harry Potter colour map. n = 256 by default. Author(s) Alejandro Jiménez Rico <aljrico@gmail.com>, Personal Blog Examples library(ggplot2) library(hexbin) dat <- data.frame(x = rnorm(10000), y = rnorm(10000)) ggplot(dat, aes(x = x, y = y)) + geom_hex() + coord_fixed() + scale_fill_gradientn(colours = hp(256, house = "Hufflepuff")) # using code from RColorBrewer to demo the palette n = 200 image( 1:n, 1, as.matrix(1:n), col = hp(n, house = "Slytherin"), xlab = "hp n", ylab = "", xaxt = "n", yaxt = "n", bty = "n" ) scale_color_hp Harry Potter colour scales Description Usage Uses the Harry Potter color scale. scale_color_hp(..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, movie = NA, house = "hufflepuff") scale_colour_hp(..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, movie = NA, house = "hufflepuff")
scale_color_hp 5 scale_fill_hp(..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, movie = NA, house = "hufflepuff") Arguments... parameters to discrete_scale or scale_fill_gradientn alpha begin end Details direction discrete movie house pass through parameter to hp The (corrected) hue in [0,1] at which the hp colormap begins. The (corrected) hue in [0,1] at which the hp colormap ends. Sets the order of colors in the scale. If 1, the default, colors are as output by hp_pal. If -1, the order of colors is reversed. generate a discrete palette? (default: FALSE - generate continuous palette) A number indicating the colormap movie to use. Eight movies are available: 1,2,3,4,5,6,7 and 8. It is also accepted to desigate the 8th movie as 7.2 and the 7th movie as 7.1. A character string indicating the colourmap from a house to use. Four houses are available: "Gryffindor", "Slytherin", "Ravenclaw" and "Hufflepuff". For discrete == FALSE (the default) all other arguments are as to scale_fill_gradientn or scale_color_gradientn. Otherwise the function will return a discrete_scale with the plot-computed number of colors. Author(s) Alejandro Jiménez Rico <aljrico@gmail.com> Examples library(ggplot2) # ripped from the pages of ggplot2 ggplot(mtcars, aes(wt, mpg)) + geom_point(size=4, aes(colour = factor(cyl))) + scale_color_hp(discrete=true, house = "Gryffindor") + theme_bw() # ripped from the pages of ggplot2 dsub <- subset(diamonds, x > 5 & x < 6 & y > 5 & y < 6) dsub$diff <- with(dsub, sqrt(abs(x-y))* sign(x-y)) ggplot(dsub, aes(x, y, colour=diff)) + geom_point() + scale_colour_hp(house = "Ravenclaw") + theme_bw() # from the main hp example dat <- data.frame(x = rnorm(10000), y = rnorm(10000))
6 scale_color_hp ggplot(dat, aes(x = x, y = y)) + geom_hex() + coord_fixed() + scale_fill_hp(house = "Hufflepuff") + theme_bw()
Index Topic datasets hp.map, 2 hp (hpmap), 2 hp.map, 2 hp_pal (hpmap), 2 hpmap, 2 hsv, 3 rgb, 4 scale_color_gradientn, 5 scale_color_hp, 4 scale_colour_hp (scale_color_hp), 4 scale_fill_gradientn, 5 scale_fill_hp (scale_color_hp), 4 7