igraph (version 0.6-2)

dendPlot.communities: Plot fully hierarchical community structures as dendrograms

Description

Plot a dendrogram that corresponds to a fully hierarchical community structure.

Usage

## S3 method for class 'communities':
dendPlot(x, mode = getIgraphOpt("dend.plot.type"),
        ..., use.modularity = FALSE)

Arguments

x
A communities object, the community structure, as returned by some igraph community detection function.
mode
Which dendrogram plotting function to use. See details below.
...
Additional arguments to supply to the dendrogram plotting function.
use.modularity
Logical scalar, whether to use the modularity scores calculated by the community detection algorithm, to set the heights of the dendrogram branches. Right now this must be FALSE for undirected graphs, for technical readons.

Value

  • Returns whatever the return value was from the plotting function, plot.phylo, plot.dendrogram or plot.hclust.

concept

  • Dendrograms
  • Community structure

Details

dendPlot supports three different plotting functions, selected via the mode argument. By default the plotting function is taken from the dend.plot.type igraph option, and it has for possible values:
  • autoChoose automatically between the plotting functions. Asplot.phylois the most sophisticated, that is choosen, whenever theapepackage is available. Otherwiseplot.hclustis used.
  • phyloUseplot.phylofrom theapepackage.
  • hclustUseplot.hclustfrom thestatspackage.
  • dendrogramUseplot.dendrogramfrom thestatspackage.

The different plotting functions take different sets of arguments. When using plot.phylo (mode="phylo"), we have the following syntax: dendPlot(communities, mode="phylo", colbar = rainbow(length(communities)), col = colbar[membership(communities)], mark.groups = communities(communities), edge.color = "#AAAAAAFF", edge.lty = c(1,2), \dots, use.modularity = FALSE) The extra arguments not documented above:

  • colbarThis is a vector of colors, in any format supported by R. These colors will be used to mark the communities on the dendrogram, ifmark.groupsare given.
  • colThe colors of the vertex labels, by default the community membership is color-coded here, using the colors from thecolbarargument.
  • mark.groupsA list of groups to mark on the tree. Groups must correspond to disjunct subtrees of the dendrogram, otherwise you might get strange results. This argument is interpreted as a list of vertex numeric ids.
  • edge.colorThe default branch color. This gives the color of the dendrogram branches that are not marked according to themark.groupsargument.
  • edge.ltyThe line types of the branches, a vector of two line types, the first value is for branches marked viamark.groups, the second value is for unmarked branches. See the documentation ofltyat the manual page ofparfor possible values. By default unmarked branches use dashed, marked branches use solid lines.
  • ...Additional arguments to pass toplot.phylo.

The syntax for plot.hclust (mode="hclust"): dendPlot(communities, mode = "hclust", rect = length(communities), colbar = rainbow(rect), hang = -1, ann = FALSE, main = "", sub = "", xlab = "", ylab = "", \dots, use.modularity = FALSE) The extra arguments not documented above:

  • rectA numeric constant, the number of groups to mark on the dendrogram. The dendrogram is cut into exactlyrectgroups and they are marked via therect.hclustcommand. Set this to zero if you don't want to mark any groups.
  • colbarThe colors of the rectanges that mark the communities via therectargument.
  • hangWhere to put the leaf nodes, this corresponds to thehangargument ofplot.hclust.
  • annWhether to annotate the plot, theannargument ofplot.hclust.
  • mainThe main title of the plot, themainargument ofplot.hclust.
  • subThe sub-title of the plot, thesubargument ofplot.hclust.
  • xlabThe label on the horizontal axis, passed toplot.hclust.
  • ylabThe label on the vertical axis, passed toplot.hclust.
  • dotsAttitional arguments to pass toplot.hclust.

The syntax for plot.dendrogram (mode="dendrogram"): dendPlot(communities, mode="dendrogram", hang = -1, \dots, use.modularity = FALSE) The extra argument not documented above:

  • hangWhere to place the leaf nodes on the plot, this is passed toas.dendrogram.

See Also

communities for other operations on communities obejcts.

Examples

Run this code
karate <- graph.famous("Zachary")
fc <- fastgreedy.community(karate)
dendPlot(fc)

Run the code above in your browser using DataLab