Learn R Programming

HilbertCurve (version 1.2.2)

hc_centered_text-HilbertCurve-method: Add text to the center of the block

Description

Add text to the center of the block

Usage

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

Arguments

object
ir
an IRanges object that contains positions which correspond to text. The middle points of the intervals will be the positions 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

  • NULL

Details

If the interval is long enough that it represents as a block in the 2D space, the corresponding label is put approximately at center (or at least inside) of the block.

It is quite experimental and only used internally.

See Also

It is basically used in hc_map,GenomicHilbertCurve-method to put chromosome names in the center of chromosomes.

Examples

Run this code
hc = HilbertCurve(1, 10)
hc_rect(hc, x1 = c(1, 3, 7), x2 = c(3, 7, 10), gp = gpar(fill = 2:5))
hc_centered_text(hc, x1 = 1, x2 = 3, labels = "A")
hc_centered_text(hc, x1 = 3, x2 = 7, labels = "B")
hc_centered_text(hc, x1 = 7, x2 = 10, labels = "C")

Run the code above in your browser using DataLab