This function is a wrapper function for plot.igraph, with 2 main additions. 1. Add the ability to color vertices by their attributes (see examples), accompanied by an inofrmative legend. 2. Resize vertex.size, edge.arrow.size, label.cex according to the plot size and the size of the network.

plotNetwork(
  graph,
  vertex.color,
  col.palette = palette(),
  layout = layout.auto,
  legend = TRUE,
  ...
)

Arguments

graph

An annotated igraph object.

vertex.color

A list of colors for vertices, or an attribute names (ex: "pathway") by which vertices will be colored. Complex attributes, where a vertex belongs to more than one group, are supported. This can also be the output of colorVertexByAttr.

col.palette

A color palette, or a palette generating function (ex:

col.palette=rainbow

).

layout

Either a graph layout function, or a two-column matrix specifiying vertex coordinates.

legend

Wheter to plot a legend. The legend is only plotted if vertices are colored by attribute values.

...

Additional arguments passed to plot.igraph.

Value

Produces a plot of the network.

Author

Ahmed Mohamed

Examples

 data("ex_kgml_sig")
 plotNetwork(ex_kgml_sig, vertex.color="pathway")
#> This graph was created by an old(er) igraph version.
#>  Call `igraph::upgrade_graph()` on it to use with the current igraph version.
#> For now we convert it on the fly...

 plotNetwork(ex_kgml_sig, vertex.color="pathway", col.palette=heat.colors)

 plotNetwork(ex_kgml_sig, vertex.color="pathway",
             col.palette=c("red", "green","blue","grey"))