[R] ?R: Removing white space betwen multiple plots, traditional graphics

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jul 22 18:10:43 CEST 2007

On 7/22/07, Mr Natural <drstrong at ucdavis.edu> wrote:
> I still have two problems with zoo for my particular application as per the
> original post of this title.
>   First, my dates are slightly different for each series. Neither of the
> two suggestions for dealing
> different-dates-for-different-series that I have found are appropriate
> (na.approx(m), na.locf.(m)).
> Is there a way that the NAs can be skipped by each plot, with lines plotted
> between the dates that exist,
> as in my original code below?

But that is precisely what na.approx does.  Here is an example:

z <- as.zoo(ldeaths)
z[c(4, 8, 17)] <- NA
zz <- cbind(z, lag(z, -5))
plot(na.approx(zz), col = 1:2) # classic
xyplot(na.approx(zz), col = 1:2) # lattice

>    Second, I have complex standard errors for each point, which are either
> read in as a distinct column
> for each y value or calculated in R and plotted with code such as (for the
> first two series):
> plot(MP~dmp, type="b",xlab="",ylim=c(0,1),xaxt = "n")
> arrows(dmp,MP+semp,dmp,MP-semp,length=.02,angle=90,code=3)
> plot(C~dc, type="b",xlab="",ylim=c(0,1),xaxt = "n")
> arrows(dc,C+sec,dc,C-sec,length=.02,angle=90,code=3)
>   I cannot get zoo to do this.

Please provide the data.

More information about the R-help mailing list