Learn R Programming

sorvi (version 0.4.05)

PlotMatrix: Visualize a matrix with one or two-way color scale. TODO: one-way color scale

Description

This function is used for fast investigation of matrix objects; standard visualization choices are made automatically; fast and easy-to-use but does not necessarily provide optimal visualization.

Usage

PlotMatrix(mat, type = "twoway", midpoint = 0,
    palette = NULL, colors = NULL, col.breaks = NULL,
    interval = 0.1, plot.axes = "both", row.tick = 1,
    col.tick = 1, cex.xlab = 0.9, cex.ylab = 0.9,
    xlab = NULL, ylab = NULL, limit.trunc = 0,
    mar = c(5, 4, 4, 2), ...)

Arguments

mat
matrix
type
String. Specifies visualization type. Options: "oneway" (color scale ranges from white to dark red; the color can be changed if needed); "twoway" (color scale ranges from dark blue through white to dark red; colors can be changed if needed)
midpoint
middle point for the color plot: smaller values are shown with blue, larger are shown with red in type = "twoway"
palette
Optional. Color palette.
colors
Optional. Colors.
col.breaks
breakpoints for the color palette
interval
interval for palette color switches
plot.axes
String. Indicates whether to plot x-axis ("x"), y-axis ("y"), or both ("both").
row.tick
interval for plotting row axis texts
col.tick
interval for plotting column axis texts
cex.xlab
use this to specify distinct font size for the x axis
cex.ylab
use this to specify distinct font size for the y axis
xlab
optional x axis labels
ylab
optional y axis labels
limit.trunc
color scale limit breakpoint
mar
image margins
...
optional parameters to be passed to function 'image', see help(image) for further details

Value

  • A list with the color palette (colors), color breakpoints (breaks), and palette function (palette.function)

References

See citation("sorvi")

Examples

Run this code
# mat <- rbind(c(1,2,3,4,5), c(1, 3, 1), c(4,2,2)); PlotMatrix(mat, "twoway", midpoint = 3)

Run the code above in your browser using DataLab