plot_stack: plot_stack

Description Usage Arguments Examples

View source: R/plot_stack.R

Description

Create violin plots of raster stacks, such as those returned from stack_imgs. Useful to assess the distribution of data across replicates e.g. over time.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
plot_stack(
  img_stack,
  n = 100,
  print_plot = TRUE,
  save_plot = FALSE,
  return_plot = FALSE,
  out_dir = NULL,
  file_name = NULL,
  file_ext = "png",
  fig_width = 8,
  fig_height = 9,
  fig_units = "cm",
  xlabel = NULL,
  ylabel = NULL,
  lab_size = 8,
  text_size = 6,
  point_size = 0.5,
  quant_linetype = "dotted",
  quant_colour = "black",
  y_breaks = waiver(),
  custom_theme = NULL
)

Arguments

img_stack

The RasterStack to plot.

n

The number of pixels to sample from each raster. Defaults to 100.

print_plot

Should the resulting plots be printed? Defaults to FALSE.

save_plot

Should the resulting plots be saved? Defaults to TRUE.

return_plot

Should the resulting plots be returned? Defaults to FALSE.

out_dir

Path to directory where plots should be saved (if applicable).

file_name

Plot filename (if applicable).

file_ext

File extension. Defaults to '.png'.

fig_width

Figure width (if saved). Defaults to 8.

fig_height

Figure height (if saved). Defaults to 9.

fig_units

Figure dimension units (if saved). Defaults to "cm".

xlabel

Option to specify the x axis label.

ylabel

Option to specify the y axis label.

lab_size

Size of axis labels. Defaults to 8.

text_size

Size of axis text. Defaults to 6.

point_size

Point size for raw data. Defaults to 0.5

quant_linetype

Linetype for the upper and lower quantile lines. Defaults to "dotted".

quant_colour

Line colour for the upper and lower quantile lines. Defaults to "black".

y_breaks

Option to manually specify breaks in y axis. Defaults to waiver(), where breaks are computed by the transformation object (see ggplot2::scale_colour_gradient).

custom_theme

Option to replace existing theme with a customised ggplot theme. See ggplot2::theme.

Examples

 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
plot_stack(img_stack = flir_stack, 
           n = 100,
           print_plot = TRUE,
           save_plot = FALSE,
           xlabel = "Time",
           ylabel = "Temperature",
           y_breaks = seq(25, 35, 1))
           
## Not run: 
# Specify custom theme
library(ggplot2)
custom_theme <- 
    theme_classic() + 
    theme(axis.title = element_text(size = 8),
          axis.text.x = element_text(size = 7,
          angle = 45,
          vjust = 0.5),
          axis.text.y = element_text(size = 7))
          
plot_stack(img_stack = flir_stack,
           print_plot = TRUE,
           save_plot = FALSE,
           custom_theme = custom_theme)

## End(Not run)

rasenior/ThermStats documentation built on Oct. 31, 2020, 3:48 p.m.