Learn R Programming

plotrix (version 2.5-2)

twoord.plot: Plot with two ordinates

Description

Two sets of values are displayed on the same plot with different ordinate scales on the left and right.

Usage

twoord.plot(lx,ly,rx,ry,data=NULL,xlim=NULL,lylim=NULL,rylim=NULL,
 mar=NULL,lcol=1,rcol=2,xlab="",ylab="",rylab="",lpch=1,rpch=2,
 type="b",...)

Arguments

lx,ly,rx,ry
y and optional x values for the plot
data
an optional data frame from which to obtain the above values
xlim
optional x limits as in plot
lylim,rylim
optional y limits for the left and right axes respectively
mar
optional margin adjustment, defaults to c(5,4,4,4)
lcol,rcol
colors to distinguish the two sets of values
xlab,ylab
axis labels as in plot
rylab
label for the right axis
lpch,rpch
plot symbols to distinguish the two sets of values
type
as in plot
...
additional arguments passed to axis.

Value

  • nil

Details

twoord.plot automates the process of displaying two sets of values that have different ranges on the same plot. It is principally useful in illustrating some relationship between the values across the observations. It is assumed that the lx and rx values are at least adjacent, and probably overlapping. It is best to pass all the arguments lx, ly, rx, ry, but the function will attempt to substitute sensible x values if one or two are missing.

See Also

plot

Examples

Run this code
twoord.plot(2:10,seq(3,7,by=0.5)+rnorm(9),
  1:15,rev(60:74)+rnorm(15),xlab="Sequence",
  ylab="Ascending values",rylab="Descending values",
  main="Test of twoord.plot")

Run the code above in your browser using DataLab