Title: | Drawing Graphs with 'grid' |
---|---|
Description: | Functions for drawing node-and-edge graphs that have been laid out by 'graphviz'. This provides an alternative rendering to that provided by the 'Rgraphviz' package, with two main advantages: the rendering provided by 'gridGraphviz' should be more similar to what 'graphviz' itself would draw; and rendering with 'grid' allows for post-hoc customisations using the named viewports and grobs that 'gridGraphviz' produces. |
Authors: | Paul Murrell [cre, aut], Ashley Noel Hinton [aut] |
Maintainer: | Paul Murrell <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.3-1 |
Built: | 2024-11-29 02:51:50 UTC |
Source: | https://github.com/r-forge/gridgraph |
Ragraph
object
This function is a wrapper for the Rgraphviz function
agopen
and will produce a laidout Ragraph
object with
layout more true to the result produced by graphviz.
agopenTrue(graph, name, nodes, edges, kind = NULL, layoutType = "dot", attrs = list(), nodeAttrs = list(), edgeAttrs = list(), subGList = list(), edgeMode = edgemode(graph), recipEdges = c("combined", "distinct"))
agopenTrue(graph, name, nodes, edges, kind = NULL, layoutType = "dot", attrs = list(), nodeAttrs = list(), edgeAttrs = list(), subGList = list(), edgeMode = edgemode(graph), recipEdges = c("combined", "distinct"))
graph |
An object of class |
nodes |
A list of |
edges |
A list of |
name |
The name of the graph |
kind |
The type of graph |
layoutType |
Defines the layout engine. Defaults to dot, and see
|
attrs |
A list of graphviz attributes |
nodeAttrs |
A list of specific node attributes |
edgeAttrs |
A list of specific edge attributes |
subGList |
A list describing subgraphs for the graph parameter |
edgeMode |
Whether the graph is directed or undirected |
recipEdges |
How to handle reciprocated edges, defaults to
|
As of Rgraphviz
version 2.2.1 (2013-01-31) agopen
:
Produces graphs of the same size as the current device, or at a default size of 7x7 inches.
Forces nodes to fixed default height and width.
Does not pass through edge weight information.
This function returns an Ragraph
object with graph
and node sizes set by graphviz or by the user. It also ensures
edge weight information is passed through.
An object of class Ragraph
Ashley Noel Hinton
graphviz
gnel <- new("graphNEL", nodes=letters[1:3], edgeL=list(a=list(edges=c("b", "c")), b=list(), c=list()), edgemode="directed") rag <- agopenTrue(gnel, "") grid.graph(rag)
gnel <- new("graphNEL", nodes=letters[1:3], edgeL=list(a=list(edges=c("b", "c")), b=list(), c=list()), edgemode="directed") rag <- agopenTrue(gnel, "") grid.graph(rag)
Ragraph
object
These functions will return the width or height of an Rgraphviz
Ragraph
object in inches.
graphWidth(graph) graphHeight(graph)
graphWidth(graph) graphHeight(graph)
graph |
a laidout |
A numeric vector of length 1.
Ashley Noel Hinton
graphviz
gnel <- new("graphNEL", nodes=letters[1:3], edgeL=list(a=list(edges=c("b", "c")), b=list(), c=list()), edgemode="directed") rag <- agopenTrue(gnel, "") graphWidth(rag) graphHeight(rag)
gnel <- new("graphNEL", nodes=letters[1:3], edgeL=list(a=list(edges=c("b", "c")), b=list(), c=list()), edgemode="directed") rag <- agopenTrue(gnel, "") graphWidth(rag) graphHeight(rag)
Take a description of the layout of a graph, as produced by the Rgraphviz package, and draw it.
grid.graph(rag, newpage = FALSE, nodesOnTop = TRUE)
grid.graph(rag, newpage = FALSE, nodesOnTop = TRUE)
rag |
An Ragraph object (must be laid out). |
newpage |
Logical value indicating whether to draw the graph on a new page. |
nodesOnTop |
Logical value indicating whether nodes should be drawn after edges (or vice versa). |
Paul Murrell
graphviz
gnel <- new("graphNEL", nodes=letters[1:3], edgeL=list(a=list(edges=c("b", "c")), b=list(), c=list()), edgemode="directed") rag <- agopen(gnel, "") grid.graph(rag)
gnel <- new("graphNEL", nodes=letters[1:3], edgeL=list(a=list(edges=c("b", "c")), b=list(), c=list()), edgemode="directed") rag <- agopen(gnel, "") grid.graph(rag)