[R] (no subject)

Dot Lundberg dotlundberg at gmail.com
Wed Apr 15 02:04:48 CEST 2015


New to R. Having trouble with the xaxis in this code. The tick marks are
crazy and the labels repeat. Any suggestions?

par(mar=c(5,5,5,5))

plot(LPB_PPT_R$newdate,LPB_PPT_R$Rain_cm,pch=0,type="l",col="black",yaxt="n",ylim=c(0,8),ylab="")
axis(side=2, at=c(0,2,4,6,8))
mtext("Precipitation (cm)", side = 2, line=2.5, at=4)
mtext("Date", side=1, line=2.5)
axis.Date(1, at=seq(min(LPB_PPT_R$newdate),
max(LPB_PPT_R$newdate),las=2,by="1 weeks"),format="%m-%Y")

par(new=TRUE)

plot(LPB_PPT_R$newdate,LPB_PPT_R$Cum_PPT,pch=1,type="l",col="grey",yaxt="n",ylim=c(0,100),
ylab="")
axis(side=4, at=c(0,50,100))
mtext("Cumulative Precipitation (cm)", side=4, line=2.5, at=50, col="grey")

	[[alternative HTML version deleted]]



More information about the R-help mailing list