view_comp: View composite of images

View source: R/view_comp.R

view_compR Documentation

View composite of images

Description

Create a single image which displays multiple image files. Tailored to support composite layouts of plots from view_xifti.

Usage

view_comp(
  img,
  ncol = NULL,
  nrow = NULL,
  legend = NULL,
  title = NULL,
  legend_height = 0.3,
  title_height = 0.1,
  title_fsize = 5,
  newpage = is.null(fname),
  fname = NULL,
  ...
)

Arguments

img

Character vector of paths to images to include. They will be arranged by row.

ncol, nrow

Control the layout of the composite image. NULL (default) will use approximately same numbers of rows and columns.

legend

File path to a legend image to add, or NULL (default) to not add a legend.

title

A length-one character vector to use as the title, or NULL (default) to not add a title.

legend_height, title_height

Heights of the legend and title, if applicable. Specified relative to all the plots, so .1 would mean the height is a tenth of the height of all the plots. Default: .1 for the title and .3 for the legend.

title_fsize

Multiplier for font size. Default: 5

newpage

Call grid::grid.newpage before rendering? Default: is.null(fname).

fname

If NULL (default), print the result. Otherwise, save to a PNG file at this location. Will override newpage to FALSE.

...

Additional arguments to gridExtra::arrangeGrob. The arguments grobs and layout_matrix should be avoided because they are determined based on img. adjusting widths may be useful, e.g. to make the subcortex subplot be less wide than the cortex subplot.

Details

Requires the following packages: png, grid, gridExtra

How it works: the non-legend images (plots) are composited in a call to grid::arrangeGrob. If a title or legend exists, it's added to the top and bottom, respectively, of the plots after with another call to grid::arangeGrob.

Value

The composite plot

See Also

Other visualizing: view_surf(), view_xifti(), view_xifti_surface(), view_xifti_volume()


ciftiTools documentation built on Oct. 4, 2024, 1:12 a.m.