Skip to contents

Functions to automatically save plots to directory of interest

Usage

.ggplot_save_function(
  gobject,
  plot_object,
  save_dir = NULL,
  save_folder = NULL,
  save_name = NULL,
  default_save_name = "giotto_plot",
  save_format = NULL,
  show_saved_plot = FALSE,
  ncol = 1,
  nrow = 1,
  scale = 1,
  base_width = NULL,
  base_height = NULL,
  base_aspect_ratio = NULL,
  units = NULL,
  dpi = NULL,
  limitsize = TRUE,
  plot_count = NULL,
  ...
)

.general_save_function(
  gobject,
  plot_object,
  save_dir = NULL,
  save_folder = NULL,
  save_name = NULL,
  default_save_name = "giotto_plot",
  save_format = c("png", "tiff", "pdf", "svg"),
  show_saved_plot = FALSE,
  base_width = NULL,
  base_height = NULL,
  base_aspect_ratio = NULL,
  units = NULL,
  dpi = NULL,
  plot_count = NULL,
  ...
)

all_plots_save_function(
  gobject,
  plot_object,
  save_dir = NULL,
  save_folder = NULL,
  save_name = NULL,
  default_save_name = "giotto_plot",
  save_format = NULL,
  show_saved_plot = FALSE,
  ncol = 1,
  nrow = 1,
  scale = 1,
  base_width = NULL,
  base_height = NULL,
  base_aspect_ratio = NULL,
  units = NULL,
  dpi = NULL,
  limitsize = TRUE,
  plot_count = NULL,
  ...
)

Arguments

gobject

giotto object or giottoInstructions

plot_object

ggplot object to plot

save_dir

directory to save to

save_folder

folder in save_dir to save to

save_name

name of plot

default_save_name

default name to save a plot

save_format

format (e.g. png, tiff, pdf, ...)

show_saved_plot

load & display the saved plot

ncol

number of columns for multiplots

nrow

number of rows for multiplot

scale

scale of plots

base_width

width of plot

base_height

height of plot

base_aspect_ratio

aspect ratio of plot

units

plotting units (e.g. in)

dpi

dpi for each plot if plot is in raster format

limitsize

When TRUE (the default), ggsave will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.

plot_count

manually set the plot count that is appended to a default_save_name

...

additional parameters to pass downstream save functions

Value

a plot file

Functions

  • .ggplot_save_function(): (internal) ggplot saving. ... passes to cowplot::save_plot

  • .general_save_function(): (internal) base and general saving. ... passes to grDevices png, tiff, pdf, svg

Examples

g <- GiottoClass::createGiottoInstructions(save_plot = TRUE)
#> 
#> no external python path or giotto
#>  environment was specified, will check if a
#>  default python path is available
#> 
#> A default python path was found: /usr/bin/python3 and will be used
#>  If this is not the correct python path, either
#> 
#> 1. use installGiottoEnvironment() to install
#>  a local miniconda python environment along with required modules
#> 
#> 2. provide an existing python path to
#>  python_path to use your own python path which has all modules
#>  installed
#> Set options("giotto.use_conda" = FALSE) if
#>  python functionalities are not needed
df <- data.frame(x = rnorm(5), y = rnorm(5))
g_plot <- ggplot2::ggplot(df, ggplot2::aes(x,y)) + ggplot2::geom_point()
all_plots_save_function(g, g_plot)