Drop-in scale_* replacements using the killerPals palettes.
Usage
scale_colour_killer_d(
palette = "greatest_hits",
type = "qualitative",
direction = 1,
...,
aesthetics = "colour",
na.value = "grey50"
)
scale_fill_killer_d(
palette = "greatest_hits",
type = "qualitative",
direction = 1,
...,
aesthetics = "fill",
na.value = "grey50"
)
scale_colour_killer_c(
palette = "greatest_hits",
type = c("sequential", "diverging"),
direction = 1,
...,
aesthetics = "colour",
na.value = "grey50",
guide = "colourbar"
)
scale_fill_killer_c(
palette = "greatest_hits",
type = c("sequential", "diverging"),
direction = 1,
...,
aesthetics = "fill",
na.value = "grey50",
guide = "colourbar"
)
scale_colour_killer_b(
palette = "greatest_hits",
type = c("sequential", "diverging"),
direction = 1,
...,
aesthetics = "colour",
na.value = "grey50",
guide = "coloursteps"
)
scale_fill_killer_b(
palette = "greatest_hits",
type = c("sequential", "diverging"),
direction = 1,
...,
aesthetics = "fill",
na.value = "grey50",
guide = "coloursteps"
)
scale_color_killer_d(
palette = "greatest_hits",
type = "qualitative",
direction = 1,
...,
aesthetics = "colour",
na.value = "grey50"
)
scale_color_killer_c(
palette = "greatest_hits",
type = c("sequential", "diverging"),
direction = 1,
...,
aesthetics = "colour",
na.value = "grey50",
guide = "colourbar"
)
scale_color_killer_b(
palette = "greatest_hits",
type = c("sequential", "diverging"),
direction = 1,
...,
aesthetics = "colour",
na.value = "grey50",
guide = "coloursteps"
)Arguments
- palette
Palette name, e.g.
"flash". Seekiller_names().- type
Palette type to draw from. Discrete scales default to
"qualitative"; continuous and binned scales default to"sequential"and accept"diverging"for data with a meaningful midpoint.- direction
1for the palette's natural order,-1to reverse it.- ...
Passed on to
ggplot2::discrete_scale(),ggplot2::continuous_scale()orggplot2::binned_scale().- aesthetics
Character string or vector of aesthetics to apply the scale to. Useful for e.g.
c("colour", "fill").- na.value
Colour for missing values.
- guide
Guide to use. See
ggplot2::guides().
Details
The suffix follows the ggplot2 convention:
_ddiscrete - one colour per category, from the palette's qualitative colours.
_ccontinuous - a smooth gradient, interpolated through CIELAB.
_bbinned - a continuous variable cut into bins.
scale_color_* spellings are provided as aliases for every
scale_colour_*.
See also
killer_pal() for the underlying colours.
Examples
library(ggplot2)
# Discrete / qualitative
ggplot(mpg, aes(displ, hwy, colour = class)) +
geom_point() +
scale_colour_killer_d("greatest_hits")
# Continuous / sequential
ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
geom_raster() +
scale_fill_killer_c("heavenly")
# Continuous / diverging, centred on zero
df <- data.frame(x = 1:20, y = 1:20, z = seq(-5, 5, length.out = 20))
ggplot(df, aes(x, y, colour = z)) +
geom_point(size = 4) +
scale_colour_killer_c("innuendo", type = "diverging",
limits = c(-5, 5))
# Binned
ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
geom_raster() +
scale_fill_killer_b("flash")
