plot.grapherator {grapherator} | R Documentation |
Visualize graph.
Description
plot.grapherator
generates a scatterplot of the nodes in the
Euclidean plane. Additionally, the edge weights are visualized. In case of one
weight per edge either a histogram or an empirical distribution function is drawn.
For graphs with two weights per edge a scatterplot is used.
Usage
## S3 method for class 'grapherator'
plot(x, y = NULL, show.cluster.centers = TRUE,
highlight.clusters = FALSE, show.edges = TRUE,
weight.plot.type = "histogram", ...)
Arguments
x |
[ |
y |
Not used at the moment. |
show.cluster.centers |
[ |
highlight.clusters |
[ |
show.edges |
[ |
weight.plot.type |
[ |
... |
[any] |
Value
[list
] A list of ggplot
objects with components
pl.weights
(scatterplot of edge weights) and eventually pl.coords
(scatterplot of
nodes). The latter is NULL
, if graph
has no associated coordinates.
Examples
g = graph(0, 100)
g = addNodes(g, n = 25, generator = addNodesGrid)
g = addEdges(g, generator = addEdgesDelauney)
g = addWeights(g, generator = addWeightsDistance, method = "manhattan")
## Not run:
pls = plot(g, weight.plot.type = "ecdf")
## End(Not run)
g = addWeights(g, generator = addWeightsRandom,
method = rpois, lambda = 0.1)
## Not run:
pls = plot(g, show.edges = FALSE)
## End(Not run)
g = graph(0, 100)
g = addNodes(g, n = 25, generator = addNodesGrid)
g = addNodes(g, n = 9, by.centers = TRUE, generator = addNodesGrid,
lower = c(0, 0), upper = c(7, 7))
g = addEdges(g, generator = addEdgesDelauney)
g = addWeights(g, generator = addWeightsCorrelated, rho = -0.8)
## Not run:
do.call(gridExtra::grid.arrange, plot(g, show.edges = FALSE))
do.call(gridExtra::grid.arrange, plot(g, show.edges = TRUE,
show.cluster.centers = FALSE))
## End(Not run)