Learn R Programming

rivervis (version 0.38.2)

RiverMap: River Layout Coordinates Calculation and Plotting

Description

This function calculates plotting coordinates for rivers and draws the river chart accordingly.

Usage

RiverMap(river, length, parent, position, distance, 
         row = NA, direction = 1, margin = 0.5,
         bd.col = "black", ln.col = "grey40", 
         ln.lty = 3, ln.lwd = 1, bg.col = "grey80",
         pt.shw = TRUE, pt.col = "black", 
         pt.pch = 20, pt.bg = "black", pt.cex = 1, pt.lwd = 1,
         mar.t = 0.05, mar.b = 0.05, mar.l = 0.2, mar.r = 0.1)

Arguments

river
a vector of river names.
length
a vector of river lengths.
parent
a vector of river parents. The parent of a river is the river into which it flows. The parent of the main stream is NA.
position
a vector of river positions. The river position indicates its position relative to its parent - whether it is a left bank river, right bank river or main stream. The left bank river is on the left when looking downstream of its parent. The right bank rive
distance
a vector of distances denotes the distance between the mouths of each river and the mouths of each river's parent.
row
a vector of row numbers. The main stream is on row 0. In the river chart, rivers with negative row numbers are plotted below the main stream while rivers with positive row numbers are plotted above the main stream. If a value for row is provided, the rive
direction
a value. In the river chart, rivers flow from right to left (direction = 1), or from left to right (direction = -1). By default, direction = 1.
margin
a value. The margin height between rivers in the topological plot. By default, margin = 0.5 and margin height is 0.5 times the river height in the river chart.
bd.col
river border colour.
bg.col
background colour.
ln.col
lead line colour.
ln.lty
lead line style.
ln.lwd
lead line width.
pt.shw
show anchor point (TRUE) or not (FALSE). Anchor points represent the locations of the river mouths.
pt.col
anchor point colour.
pt.pch
anchor point character.
pt.bg
anchor point background(fill) colour when pch=21:25.
pt.cex
anchor point size.
pt.lwd
anchor point border width.
mar.t
top margin size. This ranges in [0, 1] where 1 is the total height of the diagram region.
mar.b
bottom margin size. This ranges in [0, 1] where 1 is the total height of the diagram region.
mar.l
left margin size. This ranges in [0, 1] where 1 is the total width of the diagram region.
mar.r
right margin size. This ranges in [0, 1] where 1 is the total width of the diagram region.

Value

  • The RiverMap returns a list containing data for river map drawing, and plots the river map accordingly. The output list can be used for further plotting. The output list includes,
  • riverdataa data frame. This contains input vectors river, length, parent, position and distance. It also includes calculated x-coordinates of river mouths (rmouth) and sources (rsource), defined in the same units as the inputs length and distance. The last included vector is the row number for each river (row), in which the main stream has a fixed row number of 0.
  • H.MAXthe number of rows.
  • H.SIZEthe height of each row in the topological plot.
  • W.MAXthe width of river layout, in the same units as length and distance.
  • W.SIZEthe reciprocal of W.MAX.
  • X1normalised x-coordinate of river mouths.
  • X2normalised x-coordinate of river sources.
  • Ynormalised y-coordinate of rivers.
  • directionflow direction. Flow from right to left (direction = 1), or from left to right (direction = -1).

See Also

RiverLayout, RiverDraw, par.

Examples

Run this code
data(Ballinderry)

riverlayout <- RiverLayout(B.river$River,B.river$Length,
                           B.river$Parent,B.river$Position,
                           B.river$Distance, direction = -1)
str(riverlayout)

RiverMap(B.river$River,B.river$Length,B.river$Parent,
         B.river$Position, B.river$Distance)[[1]]

RiverMap(B.river$River,B.river$Length,B.river$Parent,
         B.river$Position, B.river$Distance, 
         row = c(5,-1,6,3,-4,2,-6,7), direction = -1)

Run the code above in your browser using DataLab