Plot Chord Diagram from a data frame
chordDiagramFromDataFrame(
df,
grid.col = NULL,
grid.border = NA,
transparency = 0.5,
col = NULL,
order = NULL,
directional = 0,
xmax = NULL,
direction.type = "diffHeight",
diffHeight = convert_height(2, "mm"),
link.target.prop = TRUE,
target.prop.height = mm_h(1),
reduce = 1e-5,
self.link = 2,
preAllocateTracks = NULL,
annotationTrack = c("name", "grid", "axis"),
annotationTrackHeight = convert_height(c(3, 2), "mm"),
link.border = NA,
link.lwd = par("lwd"),
link.lty = par("lty"),
link.auto = TRUE,
link.sort = "default",
link.decreasing = TRUE,
link.arr.length = ifelse(link.arr.type == "big.arrow", 0.02, 0.4),
link.arr.width = link.arr.length/2,
link.arr.type = "triangle",
link.arr.lty = par("lty"),
link.arr.lwd = par("lwd"),
link.arr.col = par("col"),
link.largest.ontop = FALSE,
link.visible = TRUE,
link.rank = NULL,
link.zindex = seq_len(nrow(df)),
link.overlap = FALSE,
scale = FALSE,
group = NULL,
big.gap = 10,
small.gap = 1,
plot = TRUE,
...)
A data frame which contains positions of links, see explanation in chordDiagram
.
A data frame with at least two columns. The first two columns specify the connections and the third column (optional)
contains numeric values which are mapped to the width of links as well as the colors if col
is specified as a color mapping function.
The sectors in the plot will be union(df[[1]], df[[2]])
.
Grid colors which correspond to sectors. The length of the vector should be either 1 or the number of sectors.
It's preferred that grid.col
is a named vector of which names correspond to sectors.
If it is not a named vector, the order of grid.col
corresponds to order of sectors.
border for grids. If it is NULL
, the border color is same as grid color
Transparency of link colors, 0 means no transparency and 1 means full transparency.
If transparency is already set in col
or row.col
or column.col
, this argument will be ignored.
NA
also ignores this argument.
Colors for links. It can be a vector which corresponds to connections in df
, or a function which generate colors
according to values (the third column) in df
, or a single value which means colors for all links are the same. You
may use colorRamp2
to generate a function which maps values to colors.
Order of sectors. Default order is union(df[[1]], df[[2]])
.
Whether links have directions. 1 means the direction is from the first column in df
to the second column, -1
is the reverse, 0 is no direction, and 2 for two directional. The value can be a vector which has same length as number of rows in df
.
maximum value on x-axes, the value should be a named vector.
type for representing directions. Can be one or two values in "diffHeight" and "arrows". If the value contains "diffHeight",
different heights of the links are used to represent the directions for which starting root has long height to give people feeling
that something is comming out. If the value contains "arrows", users can customize arrows with following arguments.
The value can be a vector which has same length as number of rows in df
. Note if you want to set both diffHeight
and arrows
for certain links, you need to embed these two options into one string such as "diffHeight+arrows"
.
The difference of height between two 'roots' if directional
is set to TRUE
. If the value is set to
a positive value, start root is shorter than end root and if it is set to a negative value, start root is longer
than the end root. The value can be a vector which has same length as number of rows in df
.
If the Chord diagram is directional, for each source sector, whether to draw bars that shows the proportion of target sectors.
The height of the bars when link.target.prop
is turned on.
if the ratio of the width of certain grid compared to the whole circle is less than this value, the grid is removed on the plot. Set it to value less than zero if you want to keep all tiny grid.
if there is a self link in one sector, 1 means the link will be degenerated as a 'mountain' and the width corresponds to the value for this connection. 2 means the width of the starting root and the ending root all have the same width that corresponds to the value for the connection.
Pre-allocate empty tracks before drawing Chord diagram. It can be a single number indicating how many empty tracks needed to be created or a list containing settings for empty tracks. Please refer to vignette for details.
Which annotation track should be plotted? By default, a track containing sector names and a track containing grid will be created.
Track height corresponding to values in annotationTrack
.
border for links, single scalar or a vector which has the same length as nrows of df
or a data frame
width for link borders, single scalar or a vector which has the same length as nrows of df
or a data frame
style for link borders, single scalar or a vector which has the same length as nrows of df
or a data frame
Ignored.
whether sort links on every sector based on the width of the links on it. The value can be logical. The value can also be string
"default" which automatically adjusts link orders so that links have minimal overall intersections. The value can also be a string
"asis" and it is only workable for input as a data frame so that the links have the same orders as in the original data frame.# -link.decreasing for link.sort
for link.sort
pass to circos.link
. The format of this argument is same as link.lwd
.
pass to Arrowhead
. The format of this argument is same as link.lwd
.
pass to circos.link
, same settings as link.lwd
. Default value is triangle
.
color or the single line link which is put in the center of the belt. The format of this argument is same as link.lwd
.
line width ofthe single line link which is put in the center of the belt. The format of this argument is same as link.lwd
.
line type of the single line link which is put in the center of the belt. The format of this argument is same as link.lwd
.
controls the order of adding links, whether based on the absolute value?
This is argument is removed.
whether plot the link. The value is logical, if it is set to FALSE
, the corresponding link will not
plotted, but the space is still ocuppied. The format of this argument is same as link.lwd
order to add links to the circle, a large value means to add it later.
if it is a directional Chord Diagram, whether the links that come or end in a same sector overlap?
scale each sector to same width
It contains the group labels and the sector names are used as the names in the vector.
Gaps between the sectors in the first column of df
and sectors in the second column in df
.
Small gap between sectors.
Internally used.
pass to circos.link
The data frame can have a column named "rank" which is used to control the order of adding links to the diagram.