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="Plot with two ordinates - points and lines")
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="Plot with two ordinates - bars on the left",
type=c("bar","l"),lcol=3,rcol=4)
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="Plot with two ordinates - bars on the right",
type=c("b","bar"),lcol=2,rcol=NA,halfwidth=0.2)
# histogram with density curve overlaid
xhist<-hist(rnorm(100),plot=FALSE)
xdens<-dnorm(seq(-2,2,by=0.05))
twoord.plot(xhist$mids,xhist$counts,seq(-2,2,by=0.05),
xdens,type=c("bar","l"),lcol=4,rcol=2,ylab="Counts",
rylab="Density",main="Histogram and density curve",
halfwidth=0.2)
Run the code above in your browser using DataLab