## S3 method for class 'communities':
dendPlot(x, mode = getIgraphOpt("dend.plot.type"),
..., use.modularity = FALSE)
communities
object, the community
structure, as returned by some igraph community detection function.FALSE
for undirected graphs, for technical readons.plot.phylo
, plot.dendrogram
or plot.hclust
.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: auto
Choose automatically between the plotting
functions. Asplot.phylo
is the most sophisticated, that is
choosen, whenever theape
package is available. Otherwiseplot.hclust
is used.phylo
Useplot.phylo
from theape
package.hclust
Useplot.hclust
from thestats
package.dendrogram
Useplot.dendrogram
from thestats
package. 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:
colbar
This is a vector of colors, in any format
supported by R. These colors will be used to mark the communities on
the dendrogram, ifmark.groups
are given.col
The colors of the vertex labels, by default the
community membership is color-coded here, using the colors from thecolbar
argument.mark.groups
A 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.color
The default branch color. This gives the color
of the dendrogram branches that are not marked according to themark.groups
argument.edge.lty
The 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 oflty
at the manual page ofpar
for
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:
rect
A numeric constant, the number of groups to mark on
the dendrogram. The dendrogram is cut into exactlyrect
groups and they are marked via therect.hclust
command. Set
this to zero if you don't want to mark any groups.colbar
The colors of the rectanges that mark the
communities via therect
argument.hang
Where to put the leaf nodes, this corresponds to thehang
argument ofplot.hclust
.ann
Whether to annotate the plot, theann
argument
ofplot.hclust
.main
The main title of the plot, themain
argument
ofplot.hclust
.sub
The sub-title of the plot, thesub
argument
ofplot.hclust
.xlab
The label on the horizontal axis, passed toplot.hclust
.ylab
The label on the vertical axis, passed toplot.hclust
.dots
Attitional 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:
hang
Where to place the leaf nodes on the plot, this is
passed toas.dendrogram
.communities
for other operations on
communities
obejcts.karate <- graph.famous("Zachary")
fc <- fastgreedy.community(karate)
dendPlot(fc)
Run the code above in your browser using DataLab