| split_plot | R Documentation |
Split plot into multiple subplots
split_plot(
plot,
by = NULL,
rows = NULL,
cols = NULL,
ncol = NULL,
nrow = NULL,
axes = "all",
axis.titles = "all",
scales = NULL,
...
)
plot |
A |
by |
One variable that should be used for splitting. |
rows, cols |
Two variables that should be used for splitting, representing rows and columns, respectively. |
ncol, nrow |
The number of columns and rows per page. Only takes effect when using |
axes |
Determines which axes will be drawn in case of fixed scales.
When |
axis.titles |
Determines which axis titles will be drawn.
When |
scales |
Should scales be fixed |
... |
Arguments passed on to the |
A tidyplot object.
# Before splitting
energy |>
dplyr::filter(year %in% c(2005, 2010, 2015, 2020)) |>
tidyplot(y = energy, color = energy_source) |>
add_donut() |>
adjust_size(width = 25, height = 25)
# Split by year
energy |>
dplyr::filter(year %in% c(2005, 2010, 2015, 2020)) |>
tidyplot(y = energy, color = energy_source) |>
add_donut() |>
adjust_size(width = 25, height = 25) |>
split_plot(by = year)
# Change dimensions of subplots
energy |>
dplyr::filter(year %in% c(2005, 2010, 2015, 2020)) |>
tidyplot(y = energy, color = energy_source) |>
add_donut() |>
adjust_size(width = 15, height = 15) |>
split_plot(by = year)
# Spread plots across multiple pages
energy |>
dplyr::filter(year %in% c(2005, 2010, 2015, 2020)) |>
tidyplot(y = energy, color = energy_source) |>
add_donut() |>
adjust_size(width = 25, height = 25) |>
split_plot(by = year, ncol = 2, nrow = 1)
# Split by two variables
energy |>
dplyr::mutate(decade = paste0(floor(year / 10) * 10, "s")) |>
tidyplot(y = energy, color = energy_source) |>
add_donut() |>
adjust_size(14,14) |>
split_plot(rows = decade, cols = energy_type)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.