plot2Dhist: Generate and Plot a 2D-Histogram as a Heatmap

Description Usage Arguments Details Value Author(s) See Also

View source: R/plot2Dhist.R

Description

plot2Dhist generates a two-dimensional histogram image.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plot2Dhist(
  xdata,
  ydata,
  breaks = NULL,
  xbreaks = NULL,
  ybreaks = NULL,
  base = 1,
  col,
  xlab = NULL,
  ylab = NULL,
  plot.zero = 0,
  ...
)

Arguments

xdata, ydata

Numeric vectors or matrices of the same size, with data to be plotted as a 2D-histogram. Data may also be passed in with xdata only, as a two-column array, data.frame or matrix with numeric values, but in this case, ALL SUBSEQUENT ARGUMENTS MUST BE NAMED.

breaks, xbreaks, ybreaks

Same as breaks argument to hist() function. If breaks is supplied, xbreaks and ybreaks are ignored and the same breaks are applied to each axis. Otherwise, xbreaks and ybreaks may be specified separately. If omitted, breaks are determined for each variable as per the hist() function.

base

Number specifying base for the z-axis. Default of 1 plots the intensities in each bin, untransformed. If a value greater than one is supplied, the z-axis is transformed as log(intensities+1, base).

col

Vector of colors specifying colormap to use. See, for example, hot.

xlab, ylab

Labels for the x- and y-axes. If omitted, the names of the variables used for the xdata and ydata arguments will be used.

plot.zero

Value to plot zero count bins. Use NA to make those cells with zero counts behave as NA's (i.e. having no color; see help for image).

...

Additional arguments passed to image

Details

This function calculates a histogram of the join distribution of two variables, and plots the resulting matrix as a heatmap with the first variable along the x axis an the second along the y, with values increasing from the lower left corner. The axes are presented in the units of the input data (i.e., not bin numbers, but their values.)

Value

Returns a list object with named elements:

Author(s)

M.W.Rowe, mwr.stats@gmail.com

See Also

hist, image.


mwrowe/microRutils documentation built on June 12, 2021, 2:41 p.m.