ggplot2's other discrete colour scales, for code migrating from it.
Usage
scale_color_hue(
plot,
h = c(0, 360) + 15,
c = 100,
l = 65,
h.start = 0,
direction = 1,
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "grey50",
drop = TRUE
)
scale_colour_hue(
plot,
h = c(0, 360) + 15,
c = 100,
l = 65,
h.start = 0,
direction = 1,
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "grey50",
drop = TRUE
)
scale_fill_hue(
plot,
h = c(0, 360) + 15,
c = 100,
l = 65,
h.start = 0,
direction = 1,
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "grey50",
drop = TRUE
)
scale_color_grey(
plot,
start = 0.2,
end = 0.8,
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "red",
drop = TRUE
)
scale_colour_grey(
plot,
start = 0.2,
end = 0.8,
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "red",
drop = TRUE
)
scale_fill_grey(
plot,
start = 0.2,
end = 0.8,
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "red",
drop = TRUE
)
scale_color_ordinal(
plot,
option = "viridis",
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "grey50",
drop = TRUE
)
scale_colour_ordinal(
plot,
option = "viridis",
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "grey50",
drop = TRUE
)
scale_fill_ordinal(
plot,
option = "viridis",
name = NULL,
breaks = NULL,
labels = NULL,
limits = NULL,
na.value = "grey50",
drop = TRUE
)Arguments
- plot
A PlotSpec.
- h
Range of hues, in degrees on the colour wheel.
- c, l
Chroma and luminance of the hues.
- h.start
Hue to start at.
- direction
1runs clockwise round the wheel,-1anticlockwise.- name
Legend title, or
NULLto derive from the encoding.- breaks, labels
The levels the legend shows and their labels (one per shown level, a vector named by level, or a function), or
NULL.- limits
The levels the scale covers, or
NULLfor those in the data.- na.value
Colour for missing values (and levels outside
limits).- drop
For the discrete scales, drop factor levels that no row uses (default
TRUE, as in ggplot2): they get no legend key and no palette entry, so the colours go to the levels that remain.FALSEkeeps every level.limitsoverrides it.- start, end
Grey levels of the first and last colour, in
[0, 1].- option
For
scale_*_ordinal(), the viridis map (seescale_color_viridis_d()).
Value
The modified PlotSpec.
Details
scale_*_hue()— evenly spaced hues around the HCL colour wheel (ggplot2's default discrete palette, viascales::pal_hue()).scale_*_grey()— a grey ramp fromstarttoend(0 is black, 1 white), viascales::pal_grey().scale_*_ordinal()— the viridis palette ggplot2 uses for an ordered factor (asscale_color_viridis_d()).
The colours depend on the number of levels, so they are drawn when the plot is compiled.


