Skip to contents

plot1 provides a quick way to plot out a single xy line plot. It can be used with plotprep to generate a plot outside of Rstudio or by itself to generate one within Rstudio. It uses a standard par setup and permits custom labels, font, and font size (cex). It checks the spread of y and if a ymax is not given in the parameters finds the ymax and checks to see if y goes negative in which case it uses getmin, so the y-axis is set to 0 - ymax or ymin - ymax

Usage

plot1(
  x,
  y,
  xlab = "",
  ylab = "",
  type = "l",
  usefont = 7,
  cex = 0.75,
  maxy = 0,
  defpar = TRUE,
  ...
)

Arguments

x

The single vector of x data

y

the single vector of y data. If more are required they can be added spearately after calling plot1.

xlab

the label fot the x-axis, defaults to empty

ylab

the label fot the y-axis, defaults to empty

type

the type of plot "l" is for line, the default, "p" is points. If you want both plot a line and add points afterwards.

usefont

which font to use, defaults to 7 which is Times bold

cex

the size of the fonts used. defaults to 0.85

maxy

defaults to 0, if a value is given then that value is used rather than estimating from the input y using getmax

defpar

if TRUE then plot1 will declare a par statement. If false it will expect one outside the function. In this way plot1 can be used when plotting multiple graphs, perhaps as mfrow=c(2,2)

...

room for other graphics commands like col, pch, and lwd

Value

nothing but it does plot a graph and changes the par setting

Examples

x <- rnorm(20,mean=5,sd=1)
plot1(x,x,xlab="x-values",ylab="yvalues")