Learn R Programming

circlize (version 0.4.10)

circos.polygon: Draw polygon

Description

Draw polygon

Usage

circos.polygon(
    x, y,
    sector.index = get.cell.meta.data("sector.index"),
    track.index = get.cell.meta.data("track.index"),
    ...)

Arguments

x

Data points on x-axis

y

Data points on y-axis

sector.index

Index for the sector

track.index

Index for the track

...

pass to polygon

Details

similar as polygon.

Note: start point should overlap with the end point,

Examples

Run this code
# NOT RUN {
set.seed(123)
factors = letters[1:4]
circos.initialize(factors, xlim = c(0, 1))
circos.trackPlotRegion(ylim = c(-3, 3), track.height = 0.4, panel.fun = function(x, y) {
    x1 = runif(20)
    y1 = x1 + rnorm(20)
    or = order(x1)
    x1 = x1[or]
    y1 = y1[or]
    loess.fit = loess(y1 ~ x1)
    loess.predict = predict(loess.fit, x1, se = TRUE)
    d1 = c(x1, rev(x1))
    d2 = c(loess.predict$fit + loess.predict$se.fit,
        rev(loess.predict$fit - loess.predict$se.fit))
    circos.polygon(d1, d2, col = "#CCCCCC", border = NA)
    circos.points(x1, y1, cex = 0.5)
    circos.lines(x1, loess.predict$fit)
})
circos.clear()
# }

Run the code above in your browser using DataLab