[R-sig-Geo] plotting time series for particular months!

govindas at msu.edu govindas at msu.edu
Thu Nov 4 22:36:22 CET 2010



thanks .. and it did work! but i see some jagged lines in between the years, typically like the one  joining dec of previous year and oct of the successive year. Is this how it would look like? can it be made better?

have included the plot!

heres the code..!

x.date <- as.Date(paste(chn.arr[,1], chn.arr[,2], chn.arr[,3], sep="-"))
ts.chn <- ts(chn.arr[1:2386,4])
z.chn <- zoo(ts.chn, x.date)
plot(z.chn, main = "Rainfall variations", xlab = "Year", ylab="Daily rainfall (mm)")

-- 
Regards,
Mahalakshmi
Graduate Student
#20, Department of Geography
Michigan State University
East Lansing, MI 48824 Quoting steven mosher <moshersteven at gmail.com>:

> I would look at using  the package 'zoo' your time series data would be a
> zoo object
> and then your date data  would be coerced as well,
>
> zoo, is very slick.
>
> On Thu, Nov 4, 2010 at 12:18 PM, <govindas at msu.edu> wrote:
>
>>
>>
>> Hi all,
>>
>> I have a matrix as given below...
>>
>> year month day prec
>> 1   1980    10   1 13.4
>> 2   1980    10   2  0.0
>> 3   1980    10   3  0.0
>> 4   1980    10   4  0.0
>> 5   1980    10   5  0.0
>> 6   1980    10   6  0.0
>> 7   1980    10   7  0.0
>> 8   1980    10   8  0.0
>> 9   1980    10   9  0.0
>> 10  1980    10  10  0.0
>> 11  1980    10  11  7.4
>> 12  1980    10  12  5.4
>> 13  1980    10  13  7.2
>> 14  1980    10  14  0.0
>> 15  1980    10  15  0.0
>> 16  1980    10  16  0.0
>> 17  1980    10  17 41.2
>> 18  1980    10  18  0.0
>> 19  1980    10  19  0.0
>> 20  1980    10  20  0.0
>> 21  1980    10  21  0.0
>> 22  1980    10  22  0.0
>> 23  1980    10  23  0.0
>> 24  1980    10  24  0.0
>> 25  1980    10  25  0.0
>> 26  1980    10  26  0.0
>> 27  1980    10  27  2.0
>> 28  1980    10  28  0.0
>> 29  1980    10  29  0.0
>> 30  1980    10  30  0.0
>> 31  1980    10  31  0.0
>> 32  1980    11   1  0.0
>> 33  1980    11   2  0.0
>> 34  1980    11   3  0.0
>> 35  1980    11   4  0.0
>> 36  1980    11   5 12.4
>>
>> the precipitation values extend from 1980 to 2005, but only for october,
>> november and december. I would  like to plot just these 3 months for the
>> given time period (1980 -  2005). Is there a way to get these values in the
>> x-axis. i.e. i need a  plot with its axis reading "1980, 1981, 1982 .. 2005"
>> (even if the  months are specified then it should be of more use). for now,
>> i get an  axis like .. "0, 500, ... 2000" (the plot is giving the index
>> values).
>>
>> i tried changing the freq as given below, but did not work!
>> ts.chn <- ts(chn.arr[1:2386,4], start=c(1980, 10), end=c(2005, 12),
>> freq=365)
>> plot(ts.chn)
>>
>> --
>> Regards,
>> Mahalakshmi
>> Graduate Student
>> #20, Department of Geography
>> Michigan State University
>> East Lansing, MI 48824
>>        [[alternative HTML version deleted]]
>>
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101104/f6396585/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RF_zoo.jpeg
Type: image/jpeg
Size: 79123 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101104/f6396585/attachment.jpeg>


More information about the R-sig-Geo mailing list