View source: R/draw_elev3Drgl_OCN.R
| draw_elev3Drgl_OCN | R Documentation |
Function that plots the 3D elevation map generated by an OCN.
draw_elev3Drgl_OCN(OCN, coarseGrain = c(1, 1), chooseCM = FALSE,
addColorbar = FALSE, drawRiver = FALSE, thrADraw = 0.002 *
OCN$FD$nNodes* OCN$cellsize^2, riverColor = "#00CCFF",
min_lwd = 1, max_lwd = 8, ...)
OCN |
A |
coarseGrain |
2x1 vector (only effective if |
chooseCM |
Index of catchment to display (only effective if |
addColorbar |
If |
drawRiver |
If |
thrADraw |
Threshold drainage area value used to display the network. |
riverColor |
Color used to plot the river. |
min_lwd, max_lwd |
Minimum and maximum values of line width used to display the OCN (actual line width is proportional to the square root of drainage area). |
... |
Further parameters passed to function |
This function makes use of the rgl rendering system. To export the figure in raster format, use rgl.snapshot.
To export in vectorial format, use rgl.postscript (but note that this might produce rendering issues, see rgl for details).
The function will attempt at drawing a contour of the plotted entity (i.e. the lattice or a catchment, depending on chooseCM) at null elevation, and drawing polygons connecting this contour with the
/catchment contour at the real elevation. If chooseCM != FALSE, this might result in errors owing to failure of polygon3d in triangulating the polygons.
No output is returned.
## Not run:
draw_elev3Drgl_OCN(landscape_OCN(OCN_20))
## End(Not run)
## Not run:
# 1a) draw the 3D representation of a single catchment within an OCN
# generated with nOutlet = "All" and add draw the river on top of it
OCN <- landscape_OCN(OCN_400_Allout, displayUpdates = 2) # this takes some minutes
draw_elev3Drgl_OCN(OCN, chooseCM = 983, drawRiver = TRUE)
# 1b) draw the 3D representation of the largest catchment within the OCN
# (here polygon3d may fail at plotting the polygon at zero elevation)
draw_elev3Drgl_OCN(OCN, chooseCM = TRUE)
# 1c) draw the 3D representation of the whole OCN
# and enhance the aspect ratio of Z coordinates
# with respect to the default value (the final result will be ugly):
draw_elev3Drgl_OCN(OCN, aspect = c(1, 1, 0.2))
# 1d) same as above, but operate coarse graining for better aesthetics:
draw_elev3Drgl_OCN(OCN, coarseGrain = c(5,5), aspect = c(1, 1, 0.2))
# 2) draw the 3D representation of a single catchment of an OCN generated
# with periodicBoundaries = TRUE
# (note that the real shape of the catchment is drawn)
OCN <- landscape_OCN(OCN_300_4out_PB, displayUpdates = 2) # this takes some minutes
draw_elev3Drgl_OCN(OCN, chooseCM = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.