Learn R Programming

OCNet (version 0.4.0)

draw_subcatchments_OCN: Draw subcatchment map from an Optimal Channel Network

Description

Function that draws a map of subcatchments generated by the aggregation process on the OCN.

Usage

draw_subcatchments_OCN(OCN, drawRiver = TRUE, colPalette = NULL)

Arguments

OCN

List as produced by aggregate_OCN.

drawRiver

if TRUE, draw the OCN on top of the subcatchment map.

colPalette

Color palette used. Default is c("#009900", "#FFFF00", "#FF9900", "#FF0000", "#FF00FF", "#9900CC", "#555555", "#BBBBBB"). Only the first n colors are used, where n is the number of different colors needed (calculated via a greedy coloring algorithm). colPalette accepts both functions creating color palettes and vectors of colors (see examples); in the latter case, the length of the vector cannot be lower than n (n cannot be predicted a priori, but generally 6 colors should suffice).

Value

No output is returned.

Examples

Run this code
# NOT RUN {
# 1a) aggregate a 20x20 OCN , use thrA = 5 pixels
# and draw subcatchments with default color palette
OCN <- aggregate_OCN(landscape_OCN(OCN_20), thrA = 5)
draw_subcatchments_OCN(OCN, drawRiver = TRUE)

# 1b) same as above, but define color palette with a function
draw_subcatchments_OCN(OCN, drawRiver = TRUE, colPalette = rainbow)

# 1c) same as above, but define color palette with a vector of colors
draw_subcatchments_OCN(OCN, drawRiver = TRUE, colPalette = hcl.colors(6, "Dark 3"))

# }

Run the code above in your browser using DataLab