R: Add lines to the plotting region

circos.lines {circlize} | R Documentation

## Add lines to the plotting region

### Description

Add lines to the plotting region

### Usage

    circos.lines(x, y, sector.index = get.cell.meta.data("sector.index"),
        track.index = get.cell.meta.data("track.index"),
        col = ifelse(area, "grey", par("col")), lwd = par("lwd"), lty = par("lty"),
        type = "l", straight = FALSE, area = FALSE, area.baseline = NULL,
        border = "black", baseline = "bottom", pt.col = par("col"), cex = par("cex"),
        pch = par("pch"))

### Arguments

`x` | Data points on x-axis, measured in "current" data coordinate
`y` | Data points on y-axis, measured in "current" data coordinate
`sector.index` | Index for the sector
`track.index` | Index for the track
`col` | Line color
`lwd` | line width
`lty` | line style
`type` | line type, similar as `type` argument in `lines`, but only in `c("l", "o", "h", "s")`
`straight` | whether draw straight lines between points.
`area` | whether to fill the area below the lines. If it is set to `TRUE`, `col` controls the filled color in the area and `border` controls color of the line.
`area.baseline` | deprecated, use `baseline` instead.
`baseline` | the base line to draw areas. By default it is the minimal of y-range (bottom). It can be a string or a number. If a string, it should be one of `bottom` and `top`. This argument also works if `type` is set to `h`.
`border` | color for border of the area
`pt.col` | if `type` is "o", point color
`cex` | if `type` is "o", point size
`pch` | if `type` is "o", point type

### Details

Normally, straight lines in the Cartesian coordinate have to be transformed into curves in the circular layout. But if you do not want to do such transformation you can use this function just drawing straight lines between points by setting `straight` to `TRUE`.

Drawing areas below lines can help to identify the direction of y-axis in cells (since it is a circle). This can be done by specifying `area` to `TURE`.

### References

Gu, Z. (2014) circlize implements and enhances circular visualization in R. Bioinformatics.

### Examples

    factors = letters[1:9]
    circos.par(points.overflow.warning = FALSE)
    circos.initialize(factors = factors, xlim = c(0, 10))
    circos.trackPlotRegion(factors = factors, ylim = c(0, 10), track.height = 0.5)

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "a")
    circos.text(5, 9, "type = 'l'", sector.index = "a", facing = "outside")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "b", type = "o")
    circos.text(5, 9, "type = 'o'", sector.index = "b", facing = "outside")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "c", type = "h")
    circos.text(5, 9, "type = 'h'", sector.index = "c", facing = "outside")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "d", type = "h", baseline = 5)
    circos.text(5, 9, "type = 'h', baseline = 5", sector.index = "d", facing = "outside")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "e", type = "s")
    circos.text(5, 9, "type = 's'", sector.index = "e", facing = "outside")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "f", area = TRUE)
    circos.text(5, 9, "type = 'l', area = TRUE", sector.index = "f")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "g", type = "o", area = TRUE)
    circos.text(5, 9, "type = 'o', area = TRUE", sector.index = "g")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "h", type = "s", area = TRUE)
    circos.text(5, 9, "type = 's', area = TRUE", sector.index = "h")

    circos.lines(sort(runif(10)*10), runif(10)*8, sector.index = "i", area = TRUE, baseline = "top")
    circos.text(5, 9, "type = 'l', area = TRUE\nbaseline = 'top'", sector.index = "i")

    circos.clear()

[Package circlize version 0.4.1 Index]