Learn R Programming

spacejamr (version 0.2.1)

plot.NetSim: Plot a simulated network from a NetSim object

Description

This can take either a PowerLawNetwork or APLNetwork object as input, both of which are chidren of the NetSim class.

Usage

# S3 method for NetSim
plot(
  x,
  y,
  ...,
  layout = "stress",
  title = "Network Simulation",
  node_color = "red",
  edge_color = "blue"
)

Arguments

x

a NetSim graph

y

ignored.

...

ignored.

layout

a layout to display the graph. Layout must be a valid string. from the ggraph package. Default is "stress".

title

an optional title.

node_color

a color for the nodes. Default is blue.

edge_color

a color for the edges. Default is red.

Value

A plot of classes 'ggraph' 'gg' and 'ggplot'

Details

This method returns a ggraph object, which can be further refined using standard ggraph and ggplot facilities.

Examples

Run this code
# NOT RUN {
# Load spacejamr object
data("RI")

ri_points <- PointSim(points = 10, window = RI, seed = 42)
spl_points <- NetSim(ri_points, base_prob = 0.92, scale = 1, threshold = 0.5,
                     power = -2.4)
plot(spl_points)

# }

Run the code above in your browser using DataLab