View source: R/ggplot2-scales.R
This package provides:
'color' and 'fill“ scales based on palette_playax;
'x' and 'y' scales which abbreviate large numbers with abbr_large.
1 2 3 4 5 6 7 | scale_fill_playax(..., aesthetics = "fill", palette = palette_playax())
scale_color_playax(..., aesthetics = "color", palette = palette_playax())
scale_y_abbrv(...)
scale_x_abbrv(...)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | library(ggplot2)
data <- data.frame(
day = rep(1:20, 3),
metric = do.call(c, lapply(1:3, function(x) cumsum(rnorm(20, sd = 1e7)))),
service = rep(c('facebook', 'instagram', 'spotify'), each = 20)
)
ggplot(data) +
geom_line(aes(x = day, y = metric, col = service)) +
theme_playax() +
scale_color_playax() +
scale_y_abbrv()
data <- rbind(
data,
data.frame(
day = 1:20,
metric = cumsum(rnorm(20, sd = 1e7)),
service = rep('other', 20)
)
)
ggplot(data) +
geom_line(aes(x = day, y = metric, col = service)) +
theme_playax() +
scale_color_playax(palette = palette_playax_extended(extension = c('other'))) +
scale_y_abbrv()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.