igraph (version 0.6.5-2)

plot.igraph: Plotting of graphs

Description

plot.graph is able to plot graphs to any R device. It is the non-interactive companion of the tkplot function.

Usage

## S3 method for class 'igraph':
plot(x, axes=FALSE, xlab="", ylab="", add=FALSE,
      xlim=c(-1,1), ylim=c(-1,1), main="", sub="",
      mark.groups=list(), mark.shape=1/2, 
      mark.col=rainbow(length(mark.groups), alpha=0.3),
      mark.border=rainbow(length(mark.groups), alpha=1),
      mark.expand=15, ...)

Arguments

x
The graph to plot.
axes
Logical, whether to plot axes, defaults to FALSE.
xlab
The label of the horizontal axis. Defaults to the empty string.
ylab
The label of the vertical axis. Defaults to the empty string.
add
Logical scalar, whether to add the plot to the current device, or delete the device's current contents first.
xlim
The limits for the horizontal axis, it is unlikely that you want to modify this.
ylim
The limits for the vertical axis, it is unlikely that you want to modify this.
main
Main title.
sub
Subtitle.
mark.groups
A list of vertex id vectors. It is interpreted as a set of vertex groups. Each vertex group is highlighted, by plotting a colored smoothed polygon around and under it. See the arguments below to control the look of the polygon
mark.shape
A numeric scalar or vector. Controls the smoothness of the vertex group marking polygons. This is basically the shape parameter of the xspline function, its possible val
mark.col
A scalar or vector giving the colors of marking the polygons, in any format accepted by xspline; e.g. numeric color ids, symbolic color names, or colors in RGB.
mark.border
A scalar or vector giving the colors of the borders of the vertex group marking polygons. If it is NA, then no border is drawn.
mark.expand
A numeric scalar or vector, the size of the border around the marked vertex groups. It is in the same units as the vertex sizes. If a vector is given, then different values are used for the different vertex groups.
...
Additional plotting parameters. See igraph.plotting for the complete list.

Value

  • Returns NULL, invisibly.

concept

Visualization

Details

One convenient way to plot graphs is to plot with tkplot first, handtune the placement of the vertices, query the coordinates by the tkplot.getcoords function and use them with plot to plot the graph to any R device.

See Also

layout for different layouts, igraph.plotting for the detailed description of the plotting parameters and tkplot and rglplot for other graph plotting functions.

Examples

Run this code
g <- graph.ring(10)
plot(g, layout=layout.kamada.kawai, vertex.color="green")

Run the code above in your browser using DataCamp Workspace