View source: R/scale_fill_likert.R
scale_fill_likert | R Documentation |
This scale is similar to other diverging discrete colour scales, but allows
to change the "center" of the scale using cutoff
argument, as used by
position_likert()
.
scale_fill_likert(
name = waiver(),
...,
pal = scales::brewer_pal(palette = "BrBG"),
cutoff = NULL,
aesthetics = "fill"
)
likert_pal(pal = scales::brewer_pal(palette = "BrBG"), cutoff = NULL)
name |
The name of the scale. Used as the axis or legend title.
If |
... |
Other arguments passed on to |
pal |
A palette function taking a number of colours as entry and returning a list of colours (see examples), ideally a diverging palette |
cutoff |
Number of categories displayed negatively (see
|
aesthetics |
Character string or vector of character strings listing
the name(s) of the aesthetic(s) that this scale works with. This can be
useful, for example, to apply colour settings to the colour and fill
aesthetics at the same time, via |
library(ggplot2)
ggplot(diamonds) +
aes(y = clarity, fill = cut) +
geom_bar(position = "likert") +
scale_x_continuous(label = label_percent_abs()) +
xlab("proportion")
ggplot(diamonds) +
aes(y = clarity, fill = cut) +
geom_bar(position = "likert") +
scale_x_continuous(label = label_percent_abs()) +
xlab("proportion") +
scale_fill_likert()
ggplot(diamonds) +
aes(y = clarity, fill = cut) +
geom_bar(position = position_likert(cutoff = 1)) +
scale_x_continuous(label = label_percent_abs()) +
xlab("proportion") +
scale_fill_likert(cutoff = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.