draw.density: Two-dimensional density plot of a track

View source: R/draw.density.R

draw.densityR Documentation

Two-dimensional density plot of a track

Description

This function is similar to draw.points, but draws a 2D density plot of the points instead of the points themselves.

Usage

  draw.density(slice, start, end, column = "value", cex.lab = 1, bty = "o",
    fg = "#000000", pal = grDevices::grey, border = NA, depth = 8, dpi = 7, bw.x = 0.005,
    bw.y = 0.2, precision = 1, skewing = 1.75, ...)

Arguments

slice

A data.frame holding the data to plot, with elements in rows and data in columns.

start

Single integer value, the left boundary of the window, in base pairs.

end

Single integer value, the right boundary of the window, in base pairs.

column

Single character value, the name of the slice column to use for bar heights.

cex.lab

See par.

bty

See par.

fg

Single character value, defining the color of the foreground (axes, labels...) as an english name or a hexadecimal code. Similar to par's argument but not relying on it.

pal

A function returning a set of colors when provided a set of intensities between 0 and 1 (typically grey), for the various levels of density.

border

The color to use for polygon borders (as a name, an integer or an hexadecimal character description). Special value NA can also be used to disable borders.

depth

Single integer value, the amount of different ranges to simplify the density into before plotting (corresponds to the nlevels argument of the filled.contour function).

dpi

Single numeric value, the Dots Per Inches resolution of the grid on which kde2d will compute the density. The final grid size thus also depends on the figure dimensions, as provided in inches by par("din").

bw.x

Single numeric value, the bandwidth to use for density estimation on the X (genomic) axis. Notice this value will be multiplied by the genomic width of the plotted window (in Mbp), to enforce a similar resolution at all zoom levels.

bw.y

Single numeric value, the bandiwdth to use for density estimation on the Y axis. It was typically chosen for a Y axis ranging from -1 to 1, wider axes could require wider bandwidths.

precision

Single numeric value, providing a simpler way to control the sharpness of the density plot than setting depth, dpi, bw.x and bw.y individually. The default precision of 1 has no effect on these 4 other arguments, values lower than 1 produce more averaged plots, values higher than 1 produce plots on which individual points are easier to distinguish from each others. 0 corresponds to an unreachable state of "null precision", this argument should thus be defined as a strictly positive number.

skewing

Single numeric value, defining how the color scale should be skewed toward small values. Higher skewing values makes zones of low density (typically isolated points) darker and decreases the overall contrast.

...

Further arguments to be passed to draw.bg.

Author(s)

Sylvain Mareschal

See Also

draw.bg, draw.boxes, draw.hist, draw.pileup, draw.points, draw.seq, draw.steps


Rgb documentation built on Aug. 18, 2023, 5:05 p.m.