scgradient: Scale: colour gradient Scale a continuous variable along a...

View source: R/scale-continuous.r

scgradientR Documentation

Scale: colour gradient Scale a continuous variable along a colour gradient.

Description

This scale creates a continuous colour gradient from the low colour to the mid colour to high colour, as defined in the arguments.

Usage

scgradient(
  plot,
  name = "",
  low = "red",
  mid = "white",
  high = "black",
  midpoint = 0,
  range = c(NA, NA)
)

scfillgradient(
  plot,
  name = "",
  low = "red",
  mid = "white",
  high = "black",
  midpoint = 0,
  range = c(NA, NA)
)

Arguments

plot

plot

name

namen of the scale (used in the legend)

low

colour at low end of scale

mid

colour at middle of scale

high

colour at top of scale

midpoint

definition of midpoint

range

range to scale data to

Examples

p <- scgradient(ggplot(reshape::tips, aes = list(x = sex, y = day)))
ggjitter(p, list(colour = total_bill))
ggjitter(p, list(colour = tip))

p <- ggjitter(p, list(colour = tip))
scgradient(p, low="yellow")
scgradient(p, high="green", midpoint=5)

hadley/ggplot1 documentation built on Dec. 1, 2024, 11:23 a.m.