scale_colour_manual

0th

Percentile

Create your own discrete scale.

Create your own discrete scale.

Usage
scale_colour_manual(..., values)

scale_fill_manual(..., values)

scale_size_manual(..., values)

scale_shape_manual(..., values)

scale_linetype_manual(..., values)

scale_alpha_manual(..., values)

scale_color_manual(..., values)

Arguments
values
a set of aesthetic values to map data values to.
...
common discrete scale parameters: name, breaks, labels, na.value, limits and guide. See discrete_scale for more de
Aliases
  • scale_alpha_manual
  • scale_color_manual
  • scale_colour_manual
  • scale_fill_manual
  • scale_linetype_manual
  • scale_shape_manual
  • scale_size_manual
Examples
p <- qplot(mpg, wt, data = mtcars, colour = factor(cyl))

p + scale_colour_manual(values = c("red","blue", "green"))
p + scale_colour_manual(
  values = c("8" = "red","4" = "blue","6" = "green"))
# With rgb hex values
p + scale_colour_manual(values = c("#FF0000", "#0000FF", "#00FF00"))

# As with other scales you can use breaks to control the appearance
# of the legend
cols <- c("8" = "red","4" = "blue","6" = "darkgreen", "10" = "orange")
p + scale_colour_manual(values = cols)
p + scale_colour_manual(values = cols, breaks = c("4", "6", "8"))
p + scale_colour_manual(values = cols, breaks = c("8", "6", "4"))
p + scale_colour_manual(values = cols, breaks = c("4", "6", "8"),
  labels = c("four", "six", "eight"))

# And limits to control the possible values of the scale
p + scale_colour_manual(values = cols, limits = c("4", "8"))
p + scale_colour_manual(values = cols, limits = c("4", "6", "8", "10"))
Documentation reproduced from package ggplot2, version 0.9.0, License: GPL-2

Community examples

Looks like there are no examples yet.