Learn R Programming

rtemis (version 0.79)

mplot3.img: mplot3: Image (False color 2D)

Description

Draw a bitmap from a matrix of values. This is a good way to plot a large heatmap

Usage

mplot3.img(z, as.mat = TRUE, col = colorGrad(101, space = "rgb"),
  xnames = NULL, xnames.y = 0, ynames = NULL, ynames.x = 0,
  main = NULL, main.adj = 0, main.line = 1.5, x.axis.side = 3,
  y.axis.side = 2, x.axis.line = -0.5, y.axis.line = -0.5,
  x.axis.las = 0, y.axis.las = 1, x.tick.labs.adj = NULL,
  y.tick.labs.adj = NULL, xlab = NULL, ylab = NULL, xlab.adj = 0.5,
  ylab.adj = 0.5, xlab.line = 1.7, ylab.line = 1.7, xlab.padj = 0,
  ylab.padj = 0, xlab.side = 1, ylab.side = 2, main.col = NULL,
  axlab.col = NULL, axes.col = NULL, labs.col = NULL,
  tick.col = NULL, cell.lab.hi.col = NULL, cell.lab.lo.col = NULL,
  cex = 1.2, cex.ax = NULL, cex.x = NULL, cex.y = NULL,
  x.srt = NULL, y.srt = 0, zlim = NULL, autorange = TRUE,
  pty = "m", mar = c(3, 3, 3, 3), asp = NULL, ann = FALSE,
  axes = FALSE, cell.labs = NULL, cell.labs.col = NULL,
  cell.labs.autocol = TRUE, bg = NULL, theme = "light",
  filename = NULL, file.width = NULL, file.height = NULL,
  par.reset = TRUE, ...)

Arguments

z

Input matrix

as.mat

Logical: If FALSE, rows and columns of z correspond to x and y coordinates accoridngly. This is the image default. If TRUE (default), resulting image's cells will be in the same order as values appear when you print z in the console. This is t(apply(z, 2, rev)). In this case, you can think of z as a table of values you want to pictures with colors. For example, you can convert a correlation table to a figure. In this case, you might want to add cell.labs with the values. Consider first using ddSci.

col

Colors to use. Defaults to colorGrad(100)

cell.labs

Matrix of same dimensions as z (Optional): Will be printed as strings over cells

cell.labs.col

Color for cell.labs. If NULL, the upper and lower quartiles will be set to "white", the rest "black".

bg

Background color

filename

String (Optional): Path to file where image should be saved. R-supported extensions: ".pdf", ".jpeg", ".png", ".tiff".

file.width

Output Width in inches

file.height

Output height in inches

par.reset

Logical: If TRUE, par will be reset to original settings before exit. Default = TRUE

...

Additional arguments to be passed to graphics::image

revR

Logical: If TRUE, reverse rows. Defaults to TRUE for a top-left to bottom-right diagonal

Details

This function calls image which is a lot faster than drawing heatmaps