Learn R Programming

HilbertCurve (version 1.2.2)

hc_text-HilbertCurve-method: Add text to Hilbert curve

Description

Add text to Hilbert curve

Usage

## S3 method for class 'HilbertCurve':
hc_text(object, ir, labels, x1 = NULL, x2 = x1, gp = gpar(), ...)

Arguments

object
ir
an IRanges object that contains positions which correspond to text. The middle point of the interval will be the position of the text.
labels
text corresponding to intervals in ir.
x1
if start positions are not integers, they can be set by x1.
x2
if end positions are not integers, they can be set by x2.
gp
graphic parameters for text. It should be specified by gpar.
...
pass to grid.text. E.g. you can set text justification by just here.

Value

  • A data frame which contains coordinates (in the 2D space) of text.

Details

The text is added correspoding to the middle of each interval in ir.

Examples

Run this code
hc = HilbertCurve(1, 100, level = 4, reference = TRUE)

x = sort(sample(100, 20))
s = x[1:10*2 - 1]
e = x[1:10*2]
ir = IRanges(s, e)

labels = sample(letters, length(ir), replace = TRUE)
hc_text(hc, ir, labels = labels)

Run the code above in your browser using DataLab