Skip to contents

This function will take the data.frame created by TNETutils_getLongProfile() and extract the confluences in order to easaly add them on a ggplot. See examples section for an example of use.

Usage

TNETutils_getLongProfileConfluence(
  data,
  pos = NULL,
  y = NULL,
  x = "L_Upstream",
  label = "Confluences"
)

Arguments

data

data.frame. Longitudinal profile created by TNETutils_getLongProfile()

pos

numeric Y position to set the label in the ggplot. if NULL, y must be set and the value will be min(y).

y

string Name of the column plot as Y in the ggplot in order to detect the Y position to put the label (as min(y)). if NULL, pos is used.

x

string Name of the column plot as X in the ggplot. By default the column use is 'L_Upstream'.

label

string Name of the column with the label in the ggplot. By default the column use is 'Confluences'.

Value

data.frame with all confluences and info of position in the ggplot

Examples

troncons_River <- TNETutils_getLongProfile(...)
#> Error: '...' used in an incorrect context

confluences <- TNETutils_getLongProfileConfluence(troncons_River,y='LongProfile')
#> Error: object 'troncons_River' not found

#You can copy/paste the two first lines in the ggplot bellow to add confluences with TNETutils_getLongProfileConfluence()
ggplot(data = troncons_River, aes(x=L_Upstream,y=LongProfile))+
  geom_vline(xintercept = confluences$X, color = 'grey')+
  annotate(geom="label", x=confluences$X, y=confluences$Y, label=confluences$LABEL, angle=90,hjust = 0,fill='white',size = 3)+
  geom_line()
#> Error: object 'troncons_River' not found