plot_signal: Plot a Signal or Image

View source: R/plot.R

plot_signalR Documentation

Plot a Signal or Image

Description

Plot a list of superposed or faceted signals or images (in 2D or 3D).

Usage

plot_signal(x, y, z, by, group = NULL, byrow = FALSE,
    xlim = NULL, ylim = NULL, col = NULL, alphapow = 1,
    xlab = NULL, ylab = NULL, layout = NULL, free = "",
    n = Inf, downsampler = "lttb", key = TRUE, grid = TRUE,
    isPeaks = FALSE, annPeaks = 0, engine = NULL, ...)

plot_image(x, y, z, vals, by, group = NULL, byrow = FALSE,
    zlim = NULL, xlim = NULL, ylim = NULL, col = NULL, alphapow = 1,
    zlab = NULL, xlab = NULL, ylab = NULL, layout = NULL, free = "",
    enhance = NULL, smooth = NULL, scale = NULL, key = TRUE,
    rasterImages = NULL, rasterParams = NULL, useRaster = !is3d,
    grid = TRUE, asp = 1, engine = NULL, ...)

Arguments

x, y, z, vals

Lists of vectors to plot such that x[[i]], y[[i]], etc. indicate the plot values for the ith signal or image. Attempts are made to flexibly coerce these into the expected format. If only x is provided, it is interpreted as the signal or image, and the indices or coordinates are inferred from the length or dimensions, respectively. Specifying z will plot a 2D signal. For 2D images, only one of z or vals should be provided. For 3D images, both should be provided.

by

A vector of labels indicating facets (i.e., which values should be plotted as separate sub-plots).

group

A vector of labels indicating groups (i.e., which values should be indicated by color as belonging to the same group).

byrow

If y (for plot_signal) or vals (for plot_image) is a matrix, should its rows or columns be plotted?

xlim, ylim, zlim

The plot limits. See plot.window

xlab, ylab, zlab

Plotting labels.

col

A vector giving the color map for encoding the image, or a function that returns a vector of n colors.

alphapow

The power scaling of the alpha channel (if used).

layout

A vector of the form c(nrow, ncol) specifying the number of rows and columns in the facet grid.

free

A string specifying the free spatial dimensions during faceting. E.g., "", "x", "y", or "xy".

n, downsampler

See downsample for details.

key

Should a color key be generated for the image?

grid

Should a rectangular grid be included in the plot?

isPeaks

Whether the signal should be plotted as peaks or as a continuous signal.

annPeaks

If isPeaks is TRUE, either an integer giving the number of peaks to annotate (i.e., label with their x-value), or a plotting symbol (e.g., "circle", "cross", etc.) to indicate the peak locations.

engine

The plotting engine. Default is to use base graphics. Using "plotly" requires the plotly package to be installed.

...

Additional graphical parameters (as in par) or arguments to the vizi plotting method.

enhance

The name of a contrast enhancement method, such as "hist" or "adapt" for enhance_hist() and enhance_adapt(), etc. See enhance for details.

smooth

The name of a smoothing method, such as "gauss" or "bi" for filt2_gauss() and filt2_bi(), etc. See filt2 for details.

scale

If TRUE, then all image values will be scaled to the range [0, 100]. This is useful for comparing images with differing intensity levels across facets or layers.

asp

The aspect ratio. See plot.window.

rasterImages, rasterParams

A list of rasters and raster parameters (e.g., xmin, xmax, etc.) to plot before plotting vals. These should be numeric arrays of 3 or 4 color channels with values from 0 to 1. If the raster parameters are omitted, then the raster limits are taken from the range of x and y. If the raster list has names, then these are matched against the levels of by and plotted accordingly.

useRaster

Should a bitmap raster be used for plotting? For 2D images, this is typically faster on supported devices. A fallback to polygon-based plotting is used if raster plotting is not supported. For 3D images, TRUE means to plot raster surfaces, and FALSE means to plot individual voxels as points.

Value

An object of class vizi_plot.

Author(s)

Kylie A. Bemis

See Also

vizi, vizi_pixels

Examples

require(datasets)

# plot signals
set.seed(1)
s <- simspec(6)
plot_signal(domain(s), s, group=colnames(s))

# volcano image
pos <- expand.grid(x=1:nrow(volcano), y=1:ncol(volcano))
plot_image(pos$x, pos$y, volcano, col=cpal("plasma"))

# plot original and transformed images
volcano2 <- trans2d(volcano, rotate=15, translate=c(-5, 5))
plot_image(list(original=volcano, transformed=volcano2))

kuwisdelu/matter documentation built on Dec. 8, 2024, 8:09 p.m.