toFile {Rgraphviz} | R Documentation

## Render a graph in a file with given format

### Description

Render a graph in a file with given format

### Usage

    toFile(graph,
              layoutType=c("dot","neato","twopi","circo","fdp"),
              filename,
              fileType=c("canon", "dot", "xdot", "dia", "fig",
                         "gd", "gd2", "gif", "hpgl", "imap", "cmapx",
                         "ismap", "mif", "mp", "pcl", "pdf", "pic",
                         "plain", "plain-ext", "png", "ps", "ps2",
                         "svg", "svgz", "vrml", "vtx", "wbmp"))

### Arguments

`graph` | an instance of the `Ragraph` class
`layoutType` | which layout algorithm to use
`filename` | output file name
`fileType` | output file type

### 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

    library("graph")
    library("Rgraphviz")

    g1_gz <- gzfile(system.file("GXL/graphExample-01.gxl.gz",package="graph"), open="rb")
    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")
    toFile(ag, layoutType="circo", filename="g1_circo.png", fileType="png")

[Package Rgraphviz version 1.22.2 Index]