| scale_mixtime_continuous | R Documentation |
Beyond x and y, mixtime vectors can also be mapped to colour,
fill, alpha, size, and linewidth (e.g. to shade points or lines by
when they occurred). These are the default scales used for mixtime vectors
mapped to those aesthetics, and are automatically applied. To override the
scale's behaviour manually, use scale_*_mixtime.
scale_colour_mixtime(
name = waiver(),
...,
low = "#132B43",
high = "#56B1F7",
space = "Lab",
na.value = "grey50",
guide = "colourbar",
aesthetics = "colour"
)
scale_color_mixtime(
name = waiver(),
...,
low = "#132B43",
high = "#56B1F7",
space = "Lab",
na.value = "grey50",
guide = "colourbar",
aesthetics = "colour"
)
scale_fill_mixtime(
name = waiver(),
...,
low = "#132B43",
high = "#56B1F7",
space = "Lab",
na.value = "grey50",
guide = "colourbar",
aesthetics = "fill"
)
scale_alpha_mixtime(name = waiver(), ..., range = NULL, aesthetics = "alpha")
scale_size_mixtime(name = waiver(), ..., range = NULL, aesthetics = "size")
scale_linewidth_mixtime(
name = waiver(),
...,
range = NULL,
aesthetics = "linewidth"
)
Unlike scale_x_mixtime() and scale_y_mixtime(), these scales don't draw
a common time axis shared by multiple layers, so there is only a single
aesthetic column to map. The common chronon (and, for colour/fill, the
colour gradient) is still resolved the same way as the position scales,
with mixed granularities coerced onto the finest chronon they can all be
represented in and time_breaks/time_labels accepted for time-aware
breaks and labelling.
library(ggplot2)
df <- data.frame(
time = mixtime::yearmonth(600:611),
value = as.numeric(USAccDeaths[1:12])
)
ggplot(df, aes(value, 1, colour = time)) +
geom_point(size = 5) +
scale_colour_mixtime()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.