hc_text-HilbertCurve-method {HilbertCurve} | R Documentation

## Add text to Hilbert curve

### Description

Add text to Hilbert curve

### Usage

    ## S4 method for signature 'HilbertCurve'
    hc_text(object, ir = NULL, labels, x1 = NULL, x2 = x1, gp = gpar(),
        centered_by = c("interval", "polygon"), ...)

### Arguments

`object` | A `HilbertCurve-class` 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`.
`centered_by` | how to define the "center" of the interval represented in Hilbert curve. See Details section.
`...` | pass to `grid.text`. E.g. you can set text justification by `just` here.

### Details

If `centered_by == "interval"`, the text is added correspoding to the middle of each interval in `ir`, while if `centered_by == "polygon"`, the text is put in the visual center of the polygon of the interval in the Hilbert curve.

### Value

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

### Author(s)

Zuguang Gu <z.gu@dkfz.de>

### Examples

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

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

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

[Package HilbertCurve version 1.24.0 Index]