Continuous scale
Usage
cscale(x, palette, na.value = NA_real_, trans = transform_identity())Arguments
- x
vector of continuous values to scale
- palette
palette to use.
Built in palettes:
pal_area,pal_brewer,pal_dichromat,pal_div_gradient,pal_gradient_n,pal_grey,pal_hue,pal_identity,pal_linetype,pal_manual,pal_rescale,pal_seq_gradient,pal_shape,pal_viridis- 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:
transform_asinh,transform_asn,transform_atanh,transform_boxcox,transform_compose,transform_date,transform_exp,transform_hms,transform_identity,transform_log,transform_log10,transform_log1p,transform_log2,transform_logit,transform_modulus,transform_probability,transform_probit,transform_pseudo_log,transform_reciprocal,transform_reverse,transform_sqrt,transform_time,transform_timespan,transform_yj.
Examples
with(mtcars, plot(disp, mpg, cex = cscale(hp, pal_rescale())))
with(mtcars, plot(disp, mpg, cex = cscale(hp, pal_rescale(),
trans = transform_sqrt()
)))
with(mtcars, plot(disp, mpg, cex = cscale(hp, pal_area())))
with(mtcars, plot(disp, mpg,
pch = 20, cex = 5,
col = cscale(hp, pal_seq_gradient("grey80", "black"))
))