scale_smile: Scales for smiling and frowning

scale_smile_continuousR Documentation

Scales for smiling and frowning

Description

scale_smile lets you customise how smiles are generated from your data. It also lets you tweak the appearance of legends and so on.

Usage

scale_smile_continuous(..., range = c(-1, 1), midpoint = mean)

scale_smile(..., range = c(-1, 1), midpoint = mean)

Arguments

...

Other arguments passed onto continuous_scale to control name, limits, breaks, labels and so forth.

range

Output range of smiles. +1 corresponds to a full smile and -1 corresponds to a full frown.

midpoint

A value or function of your data that will return a neutral/straight face, i.e. :-|

Details

Use range to vary how happily/sadly your maximum/minimum values are represented. Minima smaller than -1 and maxima greater than +1 are possible but might look odd! You can use midpoint to set a specific 'zero' value in your data or to have smiles represented as relative to average.

The function scale_smile is an alias of scale_smile_continuous. At some point we might also want to design a scale_smile_discrete, scale_smile_manual and so on.

Legends are a work in progress. In particular, size mappings might produce odd results.

Value

A Scale layer object for use with ggplot2.

See Also

geom_chernoff, scale_brow

Examples

library(ggplot2)
p <- ggplot(iris) +
    aes(Sepal.Width, Sepal.Length, fill = Species, smile = Sepal.Length) +
    geom_chernoff()
p
p + scale_smile_continuous(midpoint = min)
p + scale_smile_continuous(range = c(-.5, 2))


Selbosh/ggChernoff documentation built on Nov. 24, 2022, 3:29 a.m.