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.

Usage

plot_signal(x, y, by = names(y), group = NULL,
    xlim = NULL, ylim = NULL, col = NULL, byrow = FALSE,
    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 = names(vals), group = NULL,
    zlim = NULL, xlim = NULL, ylim = NULL, col = NULL, byrow = FALSE,
    zlab = NULL, xlab = NULL, ylab = NULL, layout = NULL, free = "",
    enhance = NULL, smooth = NULL, scale = NULL, key = TRUE,
    rasterImages = NULL, rasterParams = NULL, useRaster = TRUE,
    grid = TRUE, asp = 1, engine = NULL, ...)

Arguments

x, y, z, vals

Lists of vectors to plot such that x[[i]] and y[[i]] indicate the plotting coordinates for the ith signal or image. Attempts are made to flexibly coerce these into the expected format.

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).

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.

byrow

If vals is a matrix, should its rows or columns be plotted?

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? This is typically faster on supported devices. A fallback to polygon-based plotting is used if raster plotting is not supported.

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 May 1, 2024, 5:17 a.m.