Hello, All:
I want to plot level, velocity, and acceleration in three panels with
only one x axis. The code below does this using "layout". However, I
want the three plot areas to be of equal size, and this won't do that:
If I stretch the plot vertically, the relative sizes of the three panels
changes. There's probably a way to do this with ggplot2, but I have yet
to find it.
Suggestions?
Thanks,
Spencer Graves
str(AirTime <- as.numeric(time(AirPassengers)))
str(AP <- as.numeric(AirPassengers))
def.par <- par(no.readonly = TRUE) # save default, for resetting...
(mat3x1 <- matrix(1:3, 3))
plot3x1 <- layout(mat3x1, heights=c(1.4, 1, 1.5))
layout.show(plot3x1)
par(mar=c(0, 4.1, 4.1, 2.1))
plot(AirTime, AP, log='y', type='l', axes=FALSE,
main='AirPassengers', ylab='AirPassengers')
box(col='grey')
axis(2, las=1)
par(mar=c(0, 4.1, 0, 2.1))
vAP <- diff(log(AP))
plot(tail(AirTime, -1), vAP, type='l',
ylab='percent increase', axes=FALSE)
box(col='grey')
axis(2, las=1)
par(mar=c(5.1, 4.1, 0, 2.1))
plot(tail(AirTime, -2), diff(vAP), type='l',
ylab='acceleration', xlab='year',
las=1)
box(col='grey')
par(def.par)
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.