My problem is not with "plot()" but with "barplot()"! I guess it may have to do with 
the fact that the barplot's bars have a non-negligible width and the moving average 
line not! Is it?

Jos� A. S. Alegria
 
 


-----Original Message-----
From: Morten Sickel [mailto:[EMAIL PROTECTED]] 
Sent: segunda-feira, 3 de Fevereiro de 2003 11:43 AM
To: Jos� Santos Alegria; R help (E-post)
Subject: RE: [R] Overlaying a moving average curve on top of a barplot


Jose Santos Alegria wrote:

>I'm using standard barplot (Windows version 1.6.2 of R) to represent a
certain weekly 
>metric "v" and I would like to properly overlay on top of it its moving
average "mean.8" 
>(window of 8 weeks). I must be doing something wrong since the moving
average (using >"lines") doesn't overlay properly, i.e., both x-scales do not match!

Have you considered using "filter"? I made a somehov similiar plot this way: (prec 
being a data frame with 'columns' date with dates of measurements and prec, 
precipitation at the actual date)

<code>
  plot(prec)
  lines(prec$date,filter(prec$value,c(0.25,0.25,0.25,0.25))) 
</code>

Points showing actual measurements and a four periods moving average  as a line.


Hope this helps.

Morten

-- 
Morten Sickel
Norwegian Radiation Protection Authority
http://www.nrpa.no

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to