Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

circos.initialize

Initialize the circular layout


Description

Initialize the circular layout

Usage

circos.initialize(
    sectors = NULL,
    x = NULL,
    xlim = NULL,
    sector.width = NULL,
    factors = sectors)

Arguments

sectors

A factor variable or a character vector which represent data categories

factors

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

x

Data on x-axes, a vector

xlim

Ranges for values on x-axes, see "details" section for explanation of the format

sector.width

Width for each sector. The length of the vector should be either 1 which means all sectors have same width or as same as the number of sectors. Values for the vector are relative, and they will be scaled by dividing their summation. By default, it is NULL which means the width of sectors correspond to the data range in sectors.

Details

The function allocates the sectors according to the values on x-axis. The number of sectors are determined by the factors and the order of sectors are determined by the levels of factors. In this function, the start and end position for each sector on the circle (measured by degree) are calculated according to the values on x-axis or by xlim.

If x is set, the length of x must be equal to the length of factors. Then the data range for each sector are calculated from x by splitting factors.

If xlim is set, it should be a vector containing two numbers or a matrix with 2 columns. If xlim is a 2-element vector, it means all sector share the same xlim. If xlim is a 2-column matrix, the number of rows should be equal to the number of categories identified by factors, then each row of xlim corresponds to the data range for each sector and the order of rows is corresponding to the order of levels of factors. If xlim is a matrix for which row names cover all sector names, xlim is automatically adjusted.

Normally, width of sectors will be calculated internally according to the data range in sectors. But you can still set the width manually. However, it is not always a good idea to change the default sector width since the width can reflect the range of data in sectors. However, in some cases, it is useful to manually set the width such as you want to zoom some part of the sectors.

The function finally calls plot with enforing aspect ratio to be 1 and be ready for adding graphics.

See Also

Examples

# There is no example
NULL

circlize

Circular Visualization

v0.4.12
MIT + file LICENSE
Authors
Zuguang Gu
Initial release
2021-1-8

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.