autoplot.Network: Autoplot function.

Description Usage Arguments Value Examples

View source: R/autoplotNetwork.R

Description

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

Usage

1
2
3
## S3 method for class '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,…,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

1
2
3
4
5
6
7
8
9
## 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")

## End(Not run)

netgen documentation built on Jan. 9, 2020, 1:07 a.m.