Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.sfnetwork

Plot sfnetwork geometries


Description

Plot the geometries of an object of class sfnetwork.

Usage

## S3 method for class 'sfnetwork'
plot(x, draw_lines = TRUE, ...)

Arguments

x

Object of class sfnetwork.

draw_lines

If the edges of the network are spatially implicit, should straight lines be drawn between connected nodes? Defaults to TRUE. Ignored when the edges of the network are spatially explicit.

...

Arguments passed on to plot.sf

Details

This is a basic plotting functionality. For more advanced plotting, it is recommended to extract the nodes and edges from the network, and plot them separately with one of the many available spatial plotting functions as can be found in sf, tmap, ggplot2, ggspatial, and others.

Examples

oldpar = par(no.readonly = TRUE)
par(mar = c(1,1,1,1), mfrow = c(1,1))
net = as_sfnetwork(roxel)
plot(net)

# When lines are spatially implicit.
par(mar = c(1,1,1,1), mfrow = c(1,2))
net = as_sfnetwork(roxel, edges_as_lines = FALSE)
plot(net)
plot(net, draw_lines = FALSE)

# Changing default settings.
par(mar = c(1,1,1,1), mfrow = c(1,1))
plot(net, col = 'blue', pch = 18, lwd = 1, cex = 2)
par(oldpar)

sfnetworks

Tidy Geospatial Networks

v0.5.1
Apache License (>= 2)
Authors
Lucas van der Meer [aut, cre] (<https://orcid.org/0000-0001-6336-8628>), Lorena Abad [aut] (<https://orcid.org/0000-0003-0554-734X>), Andrea Gilardi [aut] (<https://orcid.org/0000-0002-9424-7439>), Robin Lovelace [aut] (<https://orcid.org/0000-0001-5679-6536>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.