Learn R Programming

netgen (version 1.3.2)

autoplot.Network: Autoplot function.

Description

Generates a ggplot object. Nice possibility to visualize 2-dimensional (clustered) networks in the euclidean plane.

Usage

# S3 method for Network
autoplot(object, path = NULL, close.path = FALSE,
  path.colour = "gray", use.opt.tour = FALSE, ...)

Arguments

object

[Network] Network.

path

[integer] An integer vector containing the order of cities of a path or a list of multiple paths. Keep in mind that instances with \(n\) nodes and \(m\) depots have \(n + m\) coordinates, with the \(1,\ldots,m\) first coordinates belonging to the depots.

close.path

[logical(1)] Logical indicating whether the path passed by path should be closed to a cycle. Default is FALSE.

path.colour

[character(1)] Colour of the lines linking nodes on a path. Default is “gray”.

use.opt.tour

[logical(1)] If the given network knows its optimal tour, should it be plotted? If this is the case and path is given additionally, the optimal tour is ignored. Default is FALSE.

...

[any] Currently not used.

Value

[ggplot]

Examples

Run this code
# NOT RUN {
# here we have no depots ...
x = generateClusteredNetwork(n.points = 30L, n.cluster = 2L)
pl = autoplot(x, path = 1:3)
# ... and here we have two depots: the path visits the depots in this case
x = generateRandomNetwork(n.points = 30L, n.depots = 2L)
pl = autoplot(x, path = 1:3, path.colour = "tomato")
# }

Run the code above in your browser using DataLab