| scale_brow_continuous {ggChernoff} | R Documentation |
Scales for angry eyebrows
Description
scale_brow lets you customise how eyebrows are generated from your data.
It also lets you tweak the appearance of legends and so on.
By default, brow is set to NA, in which case no eyebrows will appear (see Examples).
Usage
scale_brow_continuous(..., range = c(-1, 1), midpoint = mean)
scale_brow(..., range = c(-1, 1), midpoint = mean)
Arguments
... |
Other arguments passed onto |
range |
Output range of eyebrow angles. +1 corresponds to very angry and -1 corresponds to a worried look. |
midpoint |
A value or function of your data that will return level eyebrows, i.e. |
Details
Use range to vary how angrily 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 eyebrow angles represented as relative to average.
The function scale_brow is an alias of scale_brow_continuous.
At some point we might also want to design a scale_brow_discrete, scale_brow_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
Examples
library(ggplot2)
p <- ggplot(iris) +
aes(Sepal.Width, Sepal.Length, fill = Species, brow = Sepal.Length) +
geom_chernoff()
p
p + scale_brow_continuous(midpoint = min)
p + scale_brow_continuous(range = c(-.5, 2))
# Only show eyebrows if 'sad', otherwise hide them
usa <- data.frame(date = c(time(presidents)), rating = c(presidents))
ggplot(subset(usa, complete.cases(usa))) +
aes(date, rating, smile = rating, fill = rating,
brow = ifelse(rating < 50, rating, NA)) +
geom_line() +
geom_chernoff(show.legend = FALSE) +
scale_brow(range = -1:0) +
scale_fill_gradient(low = 'skyblue1', high = 'goldenrod1')