R: Plot a Graph Layout of Link Communities

plotLinkCommGraph {linkcomm} | R Documentation

## Plot a Graph Layout of Link Communities

### Description

This function is called by `plot.linkcomm` to plot a graph layout of the link communities.

### Usage

    plotLinkCommGraph(x, clusterids = 1:length(x$clusters), nodes = NULL,
            layout = layout.fruchterman.reingold, pal = brewer.pal(7, "Set2"),
            random = TRUE, node.pies = TRUE, pie.local = TRUE, vertex.radius = 0.03,
            scale.vertices = 0.05, edge.color = NULL, vshape = "none", vsize = 15,
            ewidth = 3, margin = 0, vlabel.cex = 0.8, vlabel.color = "black",
            vlabel.family = "Helvetica", vertex.color = "palegoldenrod",
            vlabel = TRUE, col.nonclusters = "black", jitter = 0.2, circle = TRUE,
            printids = TRUE, cid.cex = 1, shownodesin = 0, showall = FALSE,
            verbose = TRUE, ...)

### Arguments

`x` | An object of class `linkcomm`.
`clusterids` | An integer vector of community IDs. Defaults to all communities.
`nodes` | A character vector naming the nodes to be plotted. If NULL, then community IDs are used instead. Defaults to NULL.
`layout` | A character string or function identifying the layout algorithm to be used for positioning nodes in the graph. Defaults to `layout.fruchterman.reingold`. See details for alternative layouts.
`pal` | A character vector describing a colour palette to be used for colouring the link communities in the graph. Defaults to `brewer.pal(7, "Set2")`.
`random` | Logical, whether to randomise the link colours. Defaults to TRUE.
`node.pies` | Logical, whether to plot node pies showing as a pie chart the fraction of each node's edges which belong to each of its communities. Defaults to TRUE.
`pie.local` | Logical, whether to include pie segments for just the communities to which the chosen nodes belong, or for all communities. In the latter case, communities that are not present among the chosen nodes will appear as empty segments in the node pies. Will be ignored if node.pies is FALSE. Defaults to TRUE.
`vertex.radius` | A real number specifying the vertex radius. Defaults to 0.03. Will be ignored if node.pies is FALSE.
`scale.vertices` | A real number specifying the fraction of increase in vertex radius for each community membership. If NULL then all vertices are the same size. Defaults to 0.05. Will be ignored if node.pies is FALSE.
`edge.color` | A character string specifying the colour of edges. Defaults to `"grey"`. Will be ignored if node.pies is FALSE.
`vshape` | A character string specifying the shape of the nodes. Can be one of `"none"`, `"circle"`, `"square"`, `"csquare"`, `"rectangle"`, `"crectangle"`, and `"vrectangle"`. Defaults to `"none"`.
`vsize` | An integer vector of node sizes. If there is a single value this will be used for all nodes. If there are multiple values, it must be the same length as the number of nodes in the network to be visualized. See `graph.feature` for generating these values. This argument only has an effect when `vshape` is not set to `"none"`. Defaults to 15.
`ewidth` | An integer vector of edge widths. If there is a single value this will be used for all edges. If there are multiple values, it must be the same length as the number of edges in the network to be visualized. See `graph.feature` for generating these values. Defaults to 3.
`margin` | A numerical value specifying the amount of empty space around the graph. Negative values will zoom into the graph. Defaults to 0.
`vlabel.cex` | A numerical value specifying the size of node labels. Defaults to 0.8.
`vlabel.color` | A character string specifying the color of node labels. Defaults to `"black"`.
`vlabel.family` | A character string specifying the font family for node labels. Defaults to `"Helvetica"`.
`vertex.color` | A character string specifying the colour of nodes. If this is a character vector then the colours will be recycled. Defaults to `"palegoldenrod"`.
`vlabel` | Logical, whether node labels are to be added. Defaults to TRUE.
`col.nonclusters` | A character string specifying the colour of edges that do not belong to any communities. Will only have an effect if `showall` is TRUE. Defaults to `"black"`.
`jitter` | A numerical value specifying the range (negative to positive) of random noise that will be added to nodes that have identical x-y coordinates. Defaults to 0.2. Only used for Spencer circle layouts.
`circle` | Logical, whether to display a circle for a Spencer circle layout. Defaults to TRUE.
`printids` | Logical, whether to display community IDs at their anchor points around the Spencer circle. Defaults to TRUE.
`cid.cex` | A numerical value specifying the size of community IDs around the Spencer circle. Defaults to 1.
`shownodesin` | An integer value specifying the number of communities a node must belong to before it will be displayed. If 0 then all nodes are displayed. Defaults to 0.
`showall` | Logical, whether to display all links in the network regardless of whether they belong to communities or not. Defaults to FALSE.
`verbose` | Logical, whether to print the progress of the calculation to the screen. Defaults to TRUE.
`...` | Additional arguments to be passed to `plot`.

### Details

Here we describe the parameters for plotting link community graphs using:
`plot(x, type = "graph", layout = layout)`
Various graph layouts are available:

1. `"spencer.circle"`

2. `layout.random`

3. `layout.circle`

4. `layout.sphere`

5. `layout.fruchterman.reingold`

6. `layout.kamada.kawai`

7. `layout.spring`

8. `layout.reingold.tilford`

9. `layout.fruchterman.reingold.grid`

10. `layout.lgl`

11. `layout.graphopt`

12. `layout.mds`

13. `layout.svd`

14. `layout.norm`

All of these, except the `"spencer.circle"`, are described in more detail in the `igraph` package. The `"spencer.circle"` is described in `layout.spencer.circle`.

### Value

A graph plot.

### Author(s)

Alex T. Kalinka alex.t.kalinka@gmail.com

### References

Kalinka, A.T. and Tomancak, P. (2011). linkcomm: an R package for the generation, visualization, and analysis of link communities in networks of arbitrary size and type. Bioinformatics 27, 2011-2012.

### See Also

`plot.linkcomm`, `layout.spencer.circle`, `graph.feature`, `igraph.plotting`

### Examples

    ## Generate graph and extract link communities.
    g <- swiss[,3:4]
    lc <- getLinkCommunities(g)

    ## Plot a graph of link communities.
    plot(lc, type = "graph")

    ## Plot a graph of link communities using a Spencer circle layout.
    plot(lc, type = "graph", layout = "spencer.circle")

[Package linkcomm version 1.0-14 Index]