Skip to contents

plotprep sets up a window and the par values for a single plot. It checks to see if a graphics device is open and opens a new one if not. This is simply a utility function to save typing the standard syntax. Some of the defaults can be changed. Typing the name without () will provide a template for modification. If 'windows' is called repeatedly this will generate a new active graphics device each time leaving the older ones inactive but present. For quick exploratory plots this behaviour is not wanted, hence the check if an active device exists already or not.

Usage

plotprep(
  width = 6,
  height = 3.6,
  usefont = 7,
  cex = 0.85,
  newdev = FALSE,
  filename = "",
  resol = 300,
  verbose = TRUE
)

Arguments

width

defaults to 6 inches = 15.24cm - width of plot

height

defaults to 3 inches = 7.62cm - height of plot

usefont

default is 7 (bold Times) 1 sans serif, 2 sans serif bold

cex

default is 0.85, the font size font used for text in the plots

newdev

reuse a previously defined graphics device or make new one; defaults to FALSE

filename

defaults to "" = do not save to a filename. If a filename is input the last three characters will be checked and if they are not png then .png will be added.

resol

resolution of the png file, if defined, default=300

verbose

set this to FALSE to turn off the reminder to include a graphics.off() command after the plot. Default=TRUE

Value

Checks for and sets up a graphics device and sets the default plotting par values. This changes the current plotting options!

Examples

 x <- rnorm(1000,mean=0,sd=1.0)
 plotprep()
 hist(x,breaks=30,main="",col=2)