Learn R Programming

SDDE (version 1.0.0)

save_network: is an helper function to save an illustration of a network into a file

Description

This function saves to a file a representation of the given networks

Usage

save_network(g1,g2,filename,layout,taxnames,mode,imagesize)

Arguments

g1
the original network X
g2
the augmented network Y with additional nodes (all the original nodes from X must be present in the augmented network Y)
filename
the name of the file to save the network. Note that the file extension will automatically be added
layout
igraph layout function (default=layout.kamada.kawai)
taxnames
the taxon name of the nodes added to the original graph. By default, we select all nodes that are not in g1. Note that in order to display all the different taxa groups, you must use 'allgroup' as the taxnames argument
mode
type of file to create either: 'png', 'svg', or 'eps' (default='png')
imagesize
size of the image in pixels (default=800 px)

encoding

utf-8

Examples

Run this code
data(Sample_1)
		## Save the networks to file using the default layout (layout.kamada.kawai)
		## and size (1200px)
		save_network(g1,g2,filename="sample1",imagesize=1200)
		## Save the networks to a file using the layout.fruchterman.reingold layout, 
		## and in 'svg' format
		save_network(g1,g2,filename="s", mode="svg",layout=layout.fruchterman.reingold)
		## Save a network containing different groups
		gsample <- random_network(ngroup=4)
		save_network(gsample$g1,gsample$g2,filename="gsample", taxnames="allgroup")

Run the code above in your browser using DataLab