plot1 {MQMF}R Documentation

plot1 a quick way to plot an xy line or point plot

Description

plot1 provides a quick way to plot out a single xy line or point 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 separately after calling plot1.

xlab

the label for the x-axis, defaults to empty

ylab

the label for the y-axis, defaults to empty

type

the type of plot "l" is for line, the default, "p" is points. If you want both, then 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.75

maxy

defaults to 0, which does nothing. If a value is given then this value is used rather than estimating from the input y

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)

...

required to allow the plot to access other parameters without having to explicitly declare them in plot1, these include col, default = black, pch, if the type = "p", lwd, etc.

Value

plots a graph and sets the default plotting par values. This changes the current plotting options! The original par values are returned invisibly if the user wishes to reset.

Examples

 x <- rnorm(20,mean=5,sd=1)
 oldpar <- plot1(x,x,xlab="x-values",ylab="yvalues")
 points(x,x,pch=16,cex=1.5)
 y <- rnorm(20,mean=5,sd=1)
 plot1(x,y,type="p",cex=1.2,panel.first=grid())
 par(oldpar)

[Package MQMF version 0.1.5 Index]