Note that there are some explanatory texts on larger screens.

plurals
  1. POBarplot: changing x axe and adding line
    text
    copied!<p>I have a zoo with daily data that looks like this: <code>&gt; head(almorol)<br> 1973-10-02 1973-10-03 1973-10-04 1973-10-05 1973-10-06 1973-10-07<br> 183.9 208.2 153.7 84.8 52.5 35.5</code> </p> <p>I want to plot annual totals and a moving average so I did: </p> <p><code>y&lt;-apply.yearly(almorol, FUN=sum)<br> plot(y, main="Annual totals - Tagus (Almorol)",ylab="Q (m3/s)")<br> lines(rollapply(y, 10, mean, na.rm=TRUE), col="red", lwd=2)</code> </p> <p>Which works fine, but because the data is not continuous a line graph is not correct. If I do it with points is hard to follow so I wanted to do a barplot. However when I do <code>barplot(y)</code> the x axe appears in the format yy-mm-dd instead of just years and I can't add a line with the moving average (it doesn't give an error it just doesn't appear). </p> <p>Thanks for helping!</p> <p>edit: <code>&gt; y<br> 1973-12-31 1974-12-31 1975-12-31 1976-12-31<br> 19224.20 103766.30 72180.90 55939.80<br> 1977-12-31 1978-12-31 1979-12-31 1980-12-31<br> 215905.00 231014.21 319481.02 58979.84<br> 1981-12-31 1982-12-31 1983-12-31 1984-12-31<br> 32931.17 67989.06 83920.62 99431.75<br> 1985-12-31 1986-12-31 1987-12-31 1988-12-31<br> 161357.10 82910.87 101154.81 147541.80<br> 1989-12-31 1990-12-31 1991-12-31 1992-12-31<br> 137684.21 134974.39 89039.02 20774.72<br> 1993-12-31 1994-12-31 1995-12-31 1996-12-31<br> 58916.95 55187.38 52361.77 271064.34<br> 1997-12-31 1998-12-31 1999-12-31 2000-12-31<br> 220510.88 125116.62 42170.95 103915.99<br> 2001-12-31 2002-12-31 2003-12-31 2004-12-31<br> 244513.59 66811.15 167458.93 67223.66<br> 2005-12-31 2006-12-31 2007-12-31 2008-12-31<br> 8906.31 116874.33 79105.30 40142.61<br> 2009-12-31 2010-12-31 2011-05-31<br> 43835.34 161491.77 73093.06</code> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload