Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

toFile

Render a graph in a file with given format


Description

Render a graph in a file with given format

Usage

toFile(graph, layoutType = "dot", filename, fileType = "dot")

Arguments

graph

an instance of the Ragraph class

layoutType

Which layout algorithm to use. Defaults to dot, and see graphvizCapabilities()$layoutTypes for possible values.

filename

output file name

fileType

Output file type. Defaults to dot, and see graphvizCapabilities()$deviceTypes for possible values.

Details

This function takes a given Ragraph, does the chosen layout, then renders the output to an external file. Users could view the output file with corresponding viewer.

Value

toFile returns NULL after writing to a file.

Author(s)

Li Long <li.long@isb-sib.ch>

References

Rgraphviz by E. Ganssner, S. North, www.graphviz.org

Examples

g1_gz <- gzfile(system.file("GXL/graphExample-01.gxl.gz",
                            package="graph"))

if(require(XML)) {
  g1 <- fromGXL(g1_gz)
  ag <- agopen(g1, name="test")

  toFile(ag, layoutType="dot", filename="g1_dot.svg", fileType="svg")
  toFile(ag, layoutType="neato", filename="g1_neato.ps", fileType="ps")
  toFile(ag, layoutType="twopi", filename="g1_twopi.svg", fileType="svg")
}

Rgraphviz

Provides plotting capabilities for R graph objects

v2.34.0
EPL
Authors
Kasper Daniel Hansen [cre, aut], Jeff Gentry [aut], Li Long [aut], Robert Gentleman [aut], Seth Falcon [aut], Florian Hahne [aut], Deepayan Sarkar [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.