Skip to contents

xyplotyear meets a common need that occurs when we have xy data from multiple years and want to plot them we can use xyplotyear. The y-label for each plot is the year of data. The numeric label at the top of each plot includes the number of observations, the gradient of the regression, if included, and the sum of the yvar for each year. The same y-axis scale is used for each plot.

Usage

xyplotyear(
  x,
  yvar = "",
  xvar = "",
  year = "year",
  plotnum = c(1, 1),
  xlim = c(0, 12),
  addline = TRUE,
  origin = FALSE,
  xlab = "",
  ylab = "",
  maxy = NA
)

Arguments

x

the data.frame containing the data

yvar

the character name of y-axis column in the data.frame x

xvar

the character name of x-axis column in the data.frame x

year

the name of the year variable, default="year"

plotnum

a vector of rows and cols for the plots, default=c(1,1). This assumes that the columns are filled first using mfcol

xlim

the range of the xvar to be plotted, default=c(0,12); If c(NA,NA) the xlim is set to the range of the input xvar

addline

should a linear regression be fitted and added to each plot default=TRUE

origin

should the regression pass through the origin, default=FALSE

xlab

the generic label for the x-axis, default='', if left empty the xvar name will be used

ylab

the generic label for the y-axis, default='', if left empty the yvar name will be used

maxy

is available if you wish to vary the maximum y-axis value. The default=NA, which means it will use getmax x 1.15 to find a maximum

Value

currently nothing but it does plot a graph

Examples

print("wait on internal data")
#> [1] "wait on internal data"