[R] Help with the plot function
André Luis Neves
andrluis at ualberta.ca
Tue Jun 20 03:30:52 CEST 2017
Dear friends,
I have the following dataframe:
YEAR <- c(1996 , 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 )
T_MAR <- c(2.8, 6.5, 5.4,2.4, 4, 4.1, 3, 4.4, 4.5)
T_APR <- c(5.7, 7.8, 7.7, 4.6, 4.7, 6.2,5.7, 5.9, 7)
T_MAY <- c(7, 8.8, 10, 6, 5.5, 7.6, 8.5, 7.3, 10.2)
BUD <- c(87, 98, 93, 85, 89, 91, 87, 92, 92)
BUD_SE <- c(3.6, 2, 2.4, 4, 2.4, 2.4, 4, 2.4, 3)
g1 <- data.frame(YEAR, T_MAR, T_APR, T_MAY, BUD, BUD_SE)
###PLOT
dev.new(width=6.5, height=5)
par (cex=1, family="sans", mar=c(5,5,5,5.5))
plot(T_MAR~YEAR, type="l", pch=19, ann=F, axes=F, xlim=c(1996,2004),
ylim=c(0,12), data=g1)
title(ylab="Temperature (°C)",xlab="Year")
axis(1, at=seq(1996, 2004, 2))
axis(2, at=c(0,3,6,9,12), las=2)
par(new=T)
plot(BUD~YEAR, type="o", ann=F, axes=F, pch=19, ylim=c(60,100),data=g1)
axis(4, las=2)
mtext("Bud Break (Julian Day)", side=4, padj=4)
arrows(g1$YEAR,g1$BUD, g1$YEAR,g1$BUD + g1$BUD_SE, length=0.05, angle=90)
arrows(g1$YEAR,g1$BUD, g1$YEAR,g1$BUD-g1$BUD_SE, length=0.05, angle=90)
However, I'd like to draw a multi-panel graph with budbreak on the top (as
it is), and with the temperatures for March, April, and May on the bottom,
with their respective legends.
I was wondering if you could help me out with this.
Thanks a million for your help.
--
Andre
[[alternative HTML version deleted]]
More information about the R-help
mailing list