Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/network.make.graph.R
network.make.dot
converts an edge list as obtained by network.test.edges
into a "dot" file that can directly be used for plotting the network with graphviz.
network.make.graph
converts an edge list as obtained by network.test.edges
into a graph object.
edge.info
shows the edge weights and the edge directions.
node.degree
shows number of edges connected to a node (bi-directional/undirected edges are counted only once).
num.nodes
shows the number of nodes.
1 2 3 4 5 | network.make.dot(filename, edge.list, node.labels, main=NULL, show.edge.labels=FALSE)
network.make.graph(edge.list, node.labels, drop.singles=FALSE)
edge.info(gr)
node.degree(gr)
num.nodes(gr)
|
filename |
name of file containg the "dot" commands for graphviz |
edge.list |
a data frame, as obtained by |
node.labels |
a vector with labels for each node (will be converted to type character) |
main |
title included in plot |
show.edge.labels |
plot correlation values as edge labels (default: FALSE) |
drop.singles |
remove unconnected nodes |
gr |
a graph object |
For network plotting the software "graphviz" is employed (https://www.graphviz.org).
For the functions network.plot.graph
and network.make.graph
the "graph" and "Rgraphviz"
packages from the Bioconductor project (https://www.bioconductor.org) is required.
network.make.dot
produces a "dot" network description file that
can directly be fed into graphviz in order to produce a plot of a network.
network.make.graph
returns a graph object, suitable for plotting with functions from
the "Rgraphviz" library.
edge.info
returns a list containing vector of weights for all edges contained in a graph, and a vector listing the directions of the edges (using Rgraphviz
conventions "forward" for directed edge, and "none" for bi-directional/undirected edge).
num.nodes
returns the number of nodes.
Juliane Sch\"afer, Rainer Opgen-Rhein, and Korbinian Strimmer (https://strimmerlab.github.io).
network.test.edges
, plot.graph
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # load GeneNet library
library("GeneNet")
# generate random network with 20 nodes and 10 percent edges (=19 edges)
true.pcor <- ggm.simulate.pcor(20, 0.1)
# convert to edge list
test.results <- ggm.list.edges(true.pcor)[1:19,]
######## use graphviz directly to produce a plot ##########
# uncomment for actual use!
# nlab <- LETTERS[1:20]
# ggm.make.dot(filename="test.dot", test.results, nlab, main = "A graph")
# system("fdp -T svg -o test.svg test.dot") # SVG format
######## use Rgraphviz produce a plot ##########
# uncomment for actual use!
# nlab <- LETTERS[1:20]
# gr <- network.make.graph( test.results, nlab)
# gr
# num.nodes(gr)
# edge.info(gr)
# gr2 <- network.make.graph( test.results, nlab, drop.singles=TRUE)
# gr2
# num.nodes(gr2)
# edge.info(gr2)
# plot network
# NOTE: this requires the installation of the "Rgraphviz" library
# library("Rgraphviz")
# plot(gr, "fdp")
# plot(gr2, "fdp")
## for a full example with beautified Rgraphviz plot see
## the example scripts provide with GeneNet (e.g. arabidopis-net.R)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.