Learn R Programming

circlize (version 0.4.16)

circos.trackPoints: Add points to the plotting regions in a same track

Description

Add points to the plotting regions in a same track

Usage

circos.trackPoints(
    sectors,
    x, y,
    track.index = get.current.track.index(),
    pch = par("pch"),
    col = par("col"),
    cex = par("cex"),
    bg = par("bg"),
    factors = sectors)

Arguments

sectors

A factor or a character vector which represents the categories of data

factors

The same as sectors. It will be removed in future versions.

x

Data points on x-axis

y

Data points on y-axis

track.index

Index for the track

pch

Point type

col

Point color

cex

Point size

bg

backgrond color

Details

The function adds points in multiple cells by first splitting data into several parts in which each part corresponds to one factor (sector index) and then adding points in each cell by calling circos.points.

Length of pch, col and cex can be one, length of levels of the factors or length of factors.

This function can be replaced by a for loop containing circos.points.

Examples

Run this code
circos.initialize(letters[1:8], xlim = c(0, 1))
df = data.frame(sectors = sample(letters[1:8], 100, replace = TRUE),
                x = runif(100), y = runif(100))
circos.track(ylim = c(0, 1))
circos.trackPoints(df$sectors, x = df$x, y = df$y, pch = 16, col = as.numeric(factor(df$fa)))
circos.clear()

Run the code above in your browser using DataLab