save_graph: Save graph

Description Usage Arguments Examples

View source: R/save_graph.R

Description

Save the graph generated from graph_from_matrix or graph_from_links_nodes or compare_graphs.

Usage

1
2
save_graph(graph, filename = "foodingraph_%03d.png", width = NULL,
  height = NULL, dpi = 300, ...)

Arguments

graph

: the graph

filename

(optional) : the name of the file and format. Default is "foodingraph_*.png".

width

(optional) : width of the image in cm. Default is 25 cm for a single graph or a comparison in a vertical position. For a comparison in an horizontal position, 40cm.

height

(optional) : height of the image in cm. Default is 20 cm for a single graph, 25cm for a comparison in an horizontal position. For a comparison in a vertical position, 40cm.

dpi

(optional) : the resolution of the image in dpi. Default is 300

...

: other parameters to pass to the ggsave ggplot2 function

Examples

1
2
3
4
5
6
7
adj_matrix <- cor(iris[,-5])
legend <- data.frame(name = colnames(iris[,-5]),
                     title = colnames(iris[,-5]))
graph_iris <- graph_from_matrix(adj_matrix, legend, main_title = "Iris graph")

# Save to a in a temporary file location
save_graph(graph_iris, tempfile(fileext = ".png"))

foodingraph documentation built on Oct. 6, 2019, 5:06 p.m.