Learn R Programming

scales (version 1.2.1)

cscale: Continuous scale

Description

Continuous scale

Usage

cscale(x, palette, na.value = NA_real_, trans = identity_trans())

Arguments

x

vector of continuous values to scale

palette

palette to use.

Built in palettes: scales:::seealso_pal()

na.value

value to use for missing values

trans

transformation object describing the how to transform the raw data prior to scaling. Defaults to the identity transformation which leaves the data unchanged.

Built in transformations: scales:::seealso_trans().

Examples

Run this code
with(mtcars, plot(disp, mpg, cex = cscale(hp, rescale_pal())))
with(mtcars, plot(disp, mpg, cex = cscale(hp, rescale_pal(),
  trans = sqrt_trans()
)))
with(mtcars, plot(disp, mpg, cex = cscale(hp, area_pal())))
with(mtcars, plot(disp, mpg,
  pch = 20, cex = 5,
  col = cscale(hp, seq_gradient_pal("grey80", "black"))
))

Run the code above in your browser using DataLab