igraph (version 0.3.3)

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

plot.igraph(x, layout = layout.random, layout.par = list(), 
    labels = NULL, label.color = "darkblue", label.font = NULL, 
    label.degree = -pi/4, label.dist = 0, vertex.color = "SkyBlue2", 
    vertex.size = 15, edge.color = "darkgrey", edge.width = 1,
    edge.labels = NA, edge.lty=1, vertex.frame.color="black", margin=0,
    loop.angle=0, axes = FALSE, xlab = "", ylab = "",
    xlim=c(-1,1), ylim=c(-1,1), ...)

Arguments

x
The graph to plot.
layout
The coordinates of the vertices, or the method to calculate them. See the same argument of tkplot.
layout.par
List, the parameters of the layout function. See the same argument of tkplot.
labels
The labels of the vertices. See the same argument of tkplot.
label.color
The color(s) of the labels. See the same argument of tkplot.
label.font
The font to be used for the labels. Right now all labels use the same font.
label.degree
Specifies the placement of the labels of the vertices. See the same argument of tkplot.
label.dist
Specifies the placement of the vertex labels. See the same argument of tkplot.
vertex.color
The color(s) of the vertices. See the same argument of tkplot.
vertex.size
The size(s) of the vertices. See the same argument of tkplot.
edge.color
The color(s) of the edges. See the same argument of tkplot.
edge.width
The width(s) of the edges. See the same argument of tkplot.
edge.labels
Labels for the edges, this will be converted to a character vector. The default is NA which suppresses edge labels. The vector might contain NA's as well to suppress labels for some edges.
edge.lty
The line type for the edges, see the manual page of par for the possible values. This can be also a vector to define different a line type for each edge.
vertex.frame.color
The color(s) of the border of the vertices.
margin
The margin to add to each side of the plot.
loop.angle
Numeric vector or constant giving the angle in degrees for the drawing of the loop edges.
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.
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.
...
Additional arguments, passed to plot.

Value

  • Returns NULL, invisibly.

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. The additional arguments specified are passed to the plot function.

See Also

layout for different layouts, tkplot for the better description of the parameters and an interactive version.

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