scale_color_hp {harrypotter}R Documentation

Harry Potter colour scales

Description

Uses the Harry Potter color scale.

Usage

scale_color_hp(
  option = "Always",
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  discrete = FALSE,
  house = NULL
)

scale_colour_hp(
  option = "Always",
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  discrete = FALSE,
  house = NULL
)

scale_colour_hp_d(
  option = "Always",
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1
)

scale_color_hp_d(
  option = "Always",
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1
)

scale_fill_hp_d(
  option = "Always",
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1
)

scale_fill_hp(
  option = "Always",
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  discrete = FALSE,
  house = NULL
)

Arguments

option

A character string indicating the colourmap to use. Four houses are available: "Gryffindor", "Slytherin", "Ravenclaw" and "Hufflepuff".

...

parameters to discrete_scale or scale_fill_gradientn

alpha

pass through parameter to hp

begin

The (corrected) hue in [0,1] at which the hp colormap begins.

end

The (corrected) hue in [0,1] at which the hp colormap ends.

direction

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.

discrete

generate a discrete palette? (default: FALSE - generate continuous palette)

house

A character string indicating the colourmap from a option to use. This parameter is deprectaed, 'option' should be used instead. Four houses are available: "Gryffindor", "Slytherin", "Ravenclaw" and "Hufflepuff".

Details

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)



ggplot(mtcars, aes(factor(cyl), fill=factor(vs))) +
geom_bar() +
scale_fill_hp(discrete = TRUE, option = "Ravenclaw")

ggplot(mtcars, aes(factor(gear), fill=factor(carb))) +
geom_bar() +
scale_fill_hp(discrete = TRUE, option = "Slytherin")

ggplot(mtcars, aes(x = mpg, y = disp, colour = hp)) +
geom_point(size = 2) +
scale_colour_hp(option = "Gryffindor")





[Package harrypotter version 2.1.1 Index]