linesplot function

A spaghetti plot of grouped data

A spaghetti plot of grouped data

Orders the observations by x and thereafter plots y on x and connects observations of the same group by lines. Useful, for example, to plot a longitudinal dataset.

linesplot(x, y, group, xlab = "x", ylab = "y", main = "", cex = 0.5, pch = 19, col = 1, col.lin = 1, lw = FALSE, ylim = NULL, xlim = NULL, add = FALSE, lty = "solid", lwd=1)

Arguments

  • x, y: Numerical vectors of the same length including the x and y variables.
  • group: The variable specifying the group. Should be of the same length as vectors x and y.
  • xlab, ylab, main, cex, pch, col, col.lin, xlim, ylim, lty, lwd: Graphical parameters, see par
  • lw: Boolean. Whether a loess smoother to be added onto the plot.
  • add: Boolean. Whether to add to an existing plot or to open a new window.

Details

The observations within the group are connected at the increasing order of x.

Returns

Used for its side effects.

References

Mehtatalo, Lauri and Lappi, Juha 2020. Biometry for Forestry and Environmental Data: with examples in R. New York: Chapman and Hall/CRC. 426 p. tools:::Rd_expr_doi("10.1201/9780429173462")

Author(s)

Lauri Mehtatalo <lauri.mehtatalo@uef.fi >

Examples

D<-rep(seq(10,30),10) H<-(20+rep(rnorm(10,0,0.5),each=21))*exp(-1.5*D^(-1.3)) plot<-rep(1:10,each=21) linesplot(D,H,plot)
  • Maintainer: Lauri Mehtatalo
  • License: GPL-2
  • Last published: 2022-04-29

Useful links