Takes a plot or just of plots and converts to various formats.
convert_plots(
plot_list,
return_as = c("ggplot", "ggbio", "patchwork", "Tracks", NULL),
x_limits = NULL,
tag_levels = letters,
params_list = NULL,
verbose = TRUE
)
A plot, or a list of plots belonging to one of the following classes:
Plot class to convert plot_list
to:
x-axis limits to be applied to all plots (useful when trying to keep a common coordinate system).
A character vector defining the enumeration format to use
at each level. Possible values are 'a'
for lowercase letters, 'A'
for
uppercase letters, '1'
for numbers, 'i'
for lowercase Roman numerals, and
'I'
for uppercase Roman numerals. It can also be a list containing
character vectors defining arbitrary tag sequences. If any element in the
list is a scalar and one of 'a'
, 'A'
, '1'
, 'i
, or 'I'
, this level
will be expanded to the expected sequence.
A list of parameters to pass to tracks.
Print messages.
#### Create example plot_list ####
gg <- ggplot2::ggplot(mtcars, ggplot2::aes(mpg, cyl)) + ggplot2::geom_point()
plot_list <- lapply(1:3, function(x) gg)
##### As ggplot #####
return_out1 <- convert_plots(plot_list = plot_list, return_as = "ggplot")
#> Automatically naming plot_list.
#> Converting plots to a named list of ggplot objects.
##### As ggbio #####
return_out2 <- convert_plots(plot_list = plot_list, return_as = "ggbio")
#> Automatically naming plot_list.
#> Converting plots to a named list of ggbio objects.
##### As patchwork #####
return_out3 <- convert_plots(plot_list = plot_list, return_as = "patchwork")
#> Automatically naming plot_list.
#> Converting plots to a merged patchwork object.
##### As Tracks #####
return_out4 <- convert_plots(plot_list = plot_list, return_as = "Tracks")
#> Automatically naming plot_list.
#> Converting plots to a merged ggbio Tracks object.
##### From Tracks #####
return_out5 <- echoannot::convert_plots(plot_list = return_out4)
#> Converting plots to a named list of ggplot objects.