Last data update: 2014.03.03

R: Plots an annotated igraph object.
plotNetworkR Documentation

Plots an annotated igraph object.

Description

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.

Usage

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(s)

Ahmed Mohamed

See Also

Other Plotting methods: colorVertexByAttr; layoutVertexByAttr; plotAllNetworks; plotClassifierROC; plotClusterMatrix, plotClusterProbs, plotClusters; plotCytoscape, plotCytoscapeGML; plotPathClassifier; plotPaths

Examples

data("ex_kgml_sig")
 plotNetwork(ex_kgml_sig, vertex.color="pathway")
 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"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(NetPathMiner)
Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/NetPathMiner/plotNetwork.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotNetwork
> ### Title: Plots an annotated igraph object.
> ### Aliases: plotNetwork
> 
> ### ** Examples
> 
> data("ex_kgml_sig")
>  plotNetwork(ex_kgml_sig, vertex.color="pathway")
>  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"))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>