draw.boxes: Boxes plot of a track

View source: R/draw.boxes.R

draw.boxesR Documentation

Boxes plot of a track

Description

This function draws a slice of a track content, with a distinct box for each track element.

Usage

  draw.boxes(slice, start, end, maxElements = 50, maxDepth = 100, label = TRUE,
    labelStrand = FALSE, labelCex = 1, labelSrt = 0, labelAdj = "center",
    labelOverflow = TRUE, labelFamily = "sans", labelColor = "#000000",
	fillColor = "#BBBBBB", border = "#666666", cex.lab = 1, spacing = 0.2,
    bty = "o", groupBy = NA, groupPosition = NA, groupSize = NA, groupLwd = 1,
    fg = "#000000", normalize.y = TRUE, ...)

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.

maxElements

Single integer value, the maximum amount of boxes on the plot (if exhausted, only the amount of elements will be ploted).

maxDepth

Single integer value, the maximum amount of box heights allowed on the plot to avoid overlaps (if exhausted an error message will be ploted, turning label to FALSE might help).

label

Single logical value, whether to print labels on boxes or not.

labelStrand

Single logical value, whether to add the strand at the end of labels or not.

labelCex

Single numeric value, character expansion factor for labels.

labelSrt

Single numeric value, string rotation angle for labels.

labelAdj

'left', 'right' or 'center', the horizontal adjustement of the labels on the boxes.

labelOverflow

Single logical value, whether to write labels on boxes too narrow to host them or not.

labelFamily

Single character value, the font family to use for labels ('serif', 'sans', 'mono' or 'Hershey'). 'serif' and 'sans' are not monospaced fonts, so label box sizes and collision handling might not work as expected with them.

labelColor

The color to use for box labels (as a name, an integer or an hexadecimal character description). It can alternatively be a function without argument, which returns a vector of as many colors as boxes has rows. It can make direct variable call to any argument described on this page (including custom arguments passed via "...").

fillColor

The color to fill boxes with (as a name, an integer or an hexadecimal character description). It can alternatively be a function without argument, which returns a vector of as many colors as slice has rows. It can make direct variable call to any argument described on this page (including custom arguments passed via "...").

border

The color to use for box borders (as a name, an integer or an hexadecimal character description). It can alternatively be a function without argument, which returns a vector of as many colors as slice has rows. It can make direct variable call to any argument described on this page (including custom arguments passed via "..."). Special values NA and "fillColor" can also be used to disable borders or use fillColor respectively.

cex.lab

The relative character size of x and y axis labels (default: 1). See par.

spacing

Single numeric value, the vertical spacing between boxes, in proportion of the box height. Can alternatively be a single character value pointing a column to use to provide per-box spacing.

bty

A character string which determined the type of box which is drawn about plots. If bty is one of "o" (the default), "l", "7", "c", "u", or "]" the resulting box resembles the corresponding upper case letter. A value of "n" suppresses the box. See par.

groupBy

Single character value, the name of a slice column to use for feature grouping. Grouped features are drawn on the same line, and joined by an horizontal segment. Use NA to disable feature grouping.

groupPosition

Single character value, the name of an integer slice column with the position of the feature in the group (starting at 1). If groupBy is provided with groupPosition and groupSize, groups containing out-of-range elements will be extended to the screen boundary. Use NA if feature grouping is disabled, or if awareness of out-of-range features is not critical.

groupSize

Single character value, the name of an integer slice column with the total amount of features in the group. See groupPosition.

groupLwd

Single numeric value, the width of the line drawn to group elements.

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.

normalize.y

Single logical value, whether to normalize Y axis to 0:1 or have a Y axis growing with the number of stacked boxes. Default behavior is to fit all drawn boxes in 0:1 (default ylim), but setting normalize.y to FALSE allows to limit the display to a certain amount of boxes or to keep a consistant Y scaling between plots (for singlePlot as an example), provided that ylim is set manually and accordingly.

...

Further arguments to be passed to draw.bg.

Author(s)

Sylvain Mareschal

See Also

yline

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


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