| plot {OCNet} | R Documentation |
Plot a river
Description
Plots a river object
Usage
## S4 method for signature 'river,numeric'
plot(x, y, type, ...)
## S4 method for signature 'numeric,river'
plot(x, y, type, ...)
## S4 method for signature 'river,missing'
plot(x, type, ...)
Arguments
x |
A |
y |
A numeric vector to be displayed (or a river if |
type |
Optional argument. If |
... |
Arguments passed to the plotting functions |
Details
This is an interface to the plotting functions draw_simple_OCN, draw_elev2D_OCN, draw_contour_OCN, draw_subcatchments_OCN,
draw_thematic_OCN. If the river object does not have an elevation field (i.e., it has been generated
by create_OCN or create_general_contour_OCN, but landscape_OCN has not
been run), the plotting function used is draw_simple_OCN. If the elevation field is present, but the river
has not been aggregated (via aggregate_OCN or aggregate_river), the default plotting function used is
draw_contour_OCN. If the river has been aggregated, draw_subcatchments_OCN or draw_thematic_OCN are used depending on type.
Elevation maps can be produced with type = "elev2D", regardless of whether the river has been aggregated.
Adding scale bar and north arrow. Scale bar and north arrow can be added via terra's functions sbar and north, respectively.
However, note that arguments d and xy must be specified by the user (because no rast object is plotted). See example.
See Also
draw_simple_OCN, draw_elev2D_OCN, draw_contour_OCN, draw_subcatchments_OCN, draw_thematic_OCN
Examples
set.seed(1)
OCN <- OCN_20
plot(OCN) # equivalent to draw_simple_OCN
OCN <- landscape_OCN(OCN)
plot(OCN) # equivalent to draw_contour_OCN
plot(OCN, type = "elev2D") # equivalent to draw_elev2D_OCN
OCN <- aggregate_OCN(OCN, thrA = 4)
plot(OCN) # equivalent to draw_thematic_OCN (with no theme specified)
plot(OCN, OCN$AG$A) # equivalent to draw_thematic_OCN (with theme specified)
plot(OCN, type = "contour") # equivalent to draw_contour_OCN
plot(OCN, type = "SC") # equivalent to draw_subcatchments_OCN (with no theme specified)
plot(OCN, OCN$AG$A, type = "SC") # equivalent to draw_subcatchments_OCN (with theme specified)
# now add scale bar and north arrow
library(terra)
# sbar() # this would throw an error
# north()# this would throw an error
sbar(d=1, xy=c(min(OCN$FD$X), min(OCN$FD$Y)-1)) # this works
north(d=1, xy=c(max(OCN$FD$X)+1, max(OCN$FD$Y))) # this works