[R] plot month and year

linda.s samrobertsmith at gmail.com
Thu Jul 15 23:10:06 CEST 2010


The X axis on the plot now starts from 2008.0; Since the data starts
from January 2008, can I make it 2008.1, and also show 2009.12 on the
axis?
Thanks.
Linda

On Wed, Jul 14, 2010 at 9:49 AM, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
> You do not provide a reproducible example, as the posting guide asks you to.
> But I guess that your time series setup using ts() is insufficient, see ?ts.
> If the data starts in January 2008, why do you tell R that it starts in 1?
> Presumably you have monthly data and
>
>  unem1 <- ts(unem$a, start = c(2008, 1), freq = 12)
>  plot(unem1, type = "o")
>
> is what you want.
>
> hth,
> Z
>
> On Wed, 14 Jul 2010, linda.s wrote:
>
>> R Code begins
>> unem=read.csv("book5.csv",header=T,row.names=1)
>> attach(unem)
>> unem1=ts(unem$a, start=1)
>> ts.plot(unem1,main="a")
>> points(unem1,type="o")
>> R Code ends
>>
>> because the time starts at JAN_08 and ends on DEC_09, how to make the
>> y axis in the plot show month starting from JAN_08 instead of having
>> the current
>> ugly appearance (5, 10, 15, 20,?)?
>>
>> On Wed, Jul 14, 2010 at 9:20 AM, linda.s <samrobertsmith at gmail.com> wrote:
>>>
>>> R Code begins
>>> unem=read.csv("book5.csv",header=T,row.names=1)
>>> attach(unem)
>>> unem1=ts(unem$Allen, start=1)
>>> ts.plot(unem1,main="Allen")
>>> points(unem1,type="o")
>>> R Code ends
>>>
>>> because the time starts at JAN_08 and ends on DEC_09, how to make the
>>> y axis in the plot show month starting from JAN_08 instead of having
>>> the current
>>> ugly appearance (5, 10, 15, 20,?)?
>>>
>>
>



More information about the R-help mailing list