Learn R Programming

rivervis (version 0.38.2)

RiverLayout: River Layout Coordinates Calculation

Description

This function calculates best fit plotting coordinates to enable rivers to be shown on river charts. The output is a list, which can be used when plotting the river chart and the information on the river chart. It provides an opportunity to change the coordinates and other plotting parameters before actually plotting.

Usage

RiverLayout(river, length, parent, position, distance, 
            direction = 1, margin = 0.5)

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.
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.

Value

  • The RiverLayout returns a list containing the data for river chart plotting. The 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 vector included is the row number for each river (row), in which the main stream has a fixed row number of 0.
  • H.MAXthe number of river rows.
  • H.SIZEthe height of each river 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. Rivers flow from right to left (direction = 1), or from left to right (direction = -1).

See Also

RiverDraw, RiverMap.

Examples

Run this code
data(Ballinderry)

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

# River flows left
riverlayout.left <- RiverLayout(B.river$River,B.river$Length,
                                B.river$Parent,B.river$Position,
                                B.river$Distance)

str(riverlayout)

Run the code above in your browser using DataLab