Skip to contents

plotxyy plots two plots on the single graph so that they share the x-axis. The first series is plotted on the left vertical axis and the second on the right-hand axis.

Usage

plotxyy(
  x1,
  x2 = x1,
  y1,
  y2,
  xlab = "",
  ylab1 = "",
  ylab2 = "",
  cex = 0.85,
  fnt = 7,
  colour = c(1, 2),
  defpar = FALSE
)

Arguments

x1

the x values for the first variable. Always use the variable that has the widest x-axis values as the first variable to ensure all values are plotted.

x2

the x values for the second variable.

y1

the left-hand axis values

y2

the right-hand axis values

xlab

the x label, default=""

ylab1

the left-hand y label, default=""

ylab2

the right-hand y label, default=""

cex

the size of font on the axes, default=0.85

fnt

the font used on axes, default=7 (bold times)

colour

a vector of two values for the colour of each line, default=c(1,2) black and red

defpar

should the internal 'par' statement be used = defpar=TRUE, or the default=FALSE, which means the plot 'par' will be defined outside the plot.

Value

nothing but it plots a graph

Examples

x <- 1:20
yval1 <- rnorm(20,mean=5,sd=1)
yval2 <- rnorm(20,mean=10,sd=1)
plotxyy(x1=x,y1=yval1,y2=yval2,ylab1="mean=5",ylab2="mean=10")