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
plot1(
x,
y,
xlab = "",
ylab = "",
type = "l",
usefont = 7,
cex = 0.75,
maxy = 0,
defpar = TRUE,
...
)
The single vector of x data
the single vector of y data. If more are required they can be added spearately after calling plot1.
the label fot the x-axis, defaults to empty
the label fot the y-axis, defaults to empty
the type of plot "l" is for line, the default, "p" is points. If you want both plot a line and add points afterwards.
which font to use, defaults to 7 which is Times bold
the size of the fonts used. defaults to 0.75
defaults to 0, which does nothing. If a value is given then this value is used rather than estimating from the input y
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 funk to access its other parameters without having to explicitly declare them in plot1, these include col, default = black, pch, if the type = "p", lwd, etc.
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.
# NOT RUN {
x <- rnorm(20,mean=5,sd=1)
oldpar <- plot1(x,x,xlab="x-values",ylab="yvalues")
points(x,x,pch=16,cex=1.5)
par(oldpar)
# }
Run the code above in your browser using DataLab