hc_layer-HilbertCurve-method.Rd
Add a new layer to the Hilbert curve
A HilbertCurve-class
object.
an IRanges
object which specifies the input intervals.
if start positions are not integers, they can be set by x1
.
if end positions are not integers, they can be set by x2
.
a scalar or a vector of colors which correspond to intervals in ir
(or x1
and x2
).
a scalar or a vector of colors for the borders of intervals. Set it to NA
if borders are suppressed.
Under 'pixel' mode, each pixel represents a small window. This argument provides methods to summarize value for the small window if the input intervals can not completely overlap with the window. See explanation in hc_points,HilbertCurve-method
.
whether add grid lines to show blocks of the Hilber curve. It should be an integer number and there will be 2^(grid_line-1)-1
horizontal and vertical grid lines.
color for the grid lines
a self-defined function which defines how to overlay new layer to the plot. By default it is default_overlay
. Let's assume the red channel for the layers which are already in the plot is r0
, the red channel for the new layer is r
and the alpha channel is alpha
, the overlayed color is calculated as r*alpha + r0*(1-alpha)
. This self-defined function should accept 7 arguments which are: vectors of r, g, b channels which correspond to the layers that are already in the plot, and r, g, b, alpha channels which corresponds to the new layer. All the values passed into are between 0 to 1. The returned value for this function should be a list which contains r, g, b channels which correspond to the overlayed colors. Note that these 7 arguments only correspond to the pixels which are covered by the new layer.
This function only works under 'pixel' mode.
Under "pixel" mode, color is the only graphic representation of values in the input intervals.
To make a more precise and robust color mapping, users may consider colorRamp2
to create
a color mapping function.
If you want to add more than one layers to the curve, remember to set colors with transparency.
overlay
argument is useful for changing color themes for the overlapped areas, please refer to the vignette
to see examples of how to swith color themes in easy ways.
No value is returned.
hc = HilbertCurve(1, 100, level = 9, mode = "pixel")
x = sort(sample(100, 20))
s = x[1:10*2 - 1]
e = x[1:10*2]
require(IRanges)
ir = IRanges(s, e)
hc_layer(hc, ir)
hc = HilbertCurve(1, 100, level = 9, mode = "pixel")
hc_layer(hc, ir, grid_line = 3)
hc = HilbertCurve(1, 100, level = 9, mode = "pixel")
hc_layer(hc, ir, border = "black")