01-fill_strips.Rmd
Last updated: 2024-03-25
# Example plot from https://ggplot2.tidyverse.org/reference/facet_grid.html
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(cols = vars(drv))
p
fill_strips_top(p = p, colors = c("red", "blue", "yellow"))
# Example plot from https://ggplot2.tidyverse.org/reference/facet_grid.html
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(rows = vars(drv))
p
fill_strips_right(p = p, colors = c("red", "blue", "yellow"))
# Example plot from https://ggplot2.tidyverse.org/reference/facet_grid.html
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(cols = vars(drv), switch = "x")
p
fill_strips_bottom(p = p, colors = c("red", "blue", "yellow"))
# Example plot from https://ggplot2.tidyverse.org/reference/facet_grid.html
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(rows = vars(drv), switch = "y")
p
fill_strips_left(p = p, colors = c("red", "blue", "yellow"))
# Example plot from https://ggplot2.tidyverse.org/reference/facet_grid.html
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(rows = vars(drv), cols=vars(fl))
p
# first the top strips and then the right strips
fill_strips(p = p, side = c("top", "right"),
colors = c("gray10","gray30", "gray50","gray70","gray90",
"red", "blue", "yellow"))
# Example plot from https://ggplot2.tidyverse.org/reference/facet_grid.html
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
p <- p + facet_grid(rows = vars(drv), cols=vars(fl), switch = "both")
p
# first the bottom strips and then the left strips
fill_strips(p = p, side = c("bottom", "left"),
colors = c("gray10","gray30", "gray50","gray70","gray90",
"red", "blue", "yellow"))