RiverLayout: River Layout Coordinates Calculation

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/RiverLayout.R

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

1
2
RiverLayout(river, length, parent, position, distance, row = NA,
  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 river is on the right when looking downstream of its parent. The value of position can be "R", "L" or "M". For the main stream, the value is "M".

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 rivers will be plotted according to the provided row numbers. If a value for row is not provided, a vector of best fit row numbers will be calculated before plotting.

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,

riverdata

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

the number of river rows.

H.SIZE

the height of each river row in the topological plot.

W.MAX

the width of river layout, in the same units as length and distance.

W.SIZE

the reciprocal of W.MAX.

X1

normalised x-coordinate of river mouths.

X2

normalised x-coordinate of river sources.

Y

normalised y-coordinate of rivers.

direction

flow direction. Rivers flow from right to left (direction = 1), or from left to right (direction = -1).

Note

There is one and only one mainstream input for each function call.

Author(s)

Feng Mao

See Also

RiverDraw, RiverMap.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

rivervis documentation built on May 1, 2019, 7:28 p.m.