Time series graph

32 views
Skip to first unread message

serdar neslihanoglu

unread,
Jun 7, 2009, 3:38:05 PM6/7/09
to ggplot2
Can you help me to create time series graph (acf and pacf ) wıth
ggplot2 ?
Do you have an example related to this subject ?

Mike Lawrence

unread,
Jun 7, 2009, 8:35:50 PM6/7/09
to serdar neslihanoglu, ggplot2
There are plenty of time series plots demonstrated in the ggplot2 book
(http://had.co.nz/ggplot2/book/). If you need further help, please ask
a more detailed question and provide small reproducible examples.

Mike

2009/6/7 serdar neslihanoglu <snes...@gmail.com>:
>
> Can you help me to create time series graph (acf and pacf ) wıth
> ggplot2 ?
> Do you have an example related to this subject ?
> >
>



--
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

serdar neslihanoglu

unread,
Jun 9, 2009, 12:25:51 AM6/9/09
to ggplot2
ok
I have already checked the ggplot book but
thıs book only has tıme serıes lıne graph.
Moreover , ggplot book never show how to
draw ACF and Pacf graph of tıme serıes.
Do you have another ıdea of tıme serıes graph?

On 8 Haziran, 03:35, Mike Lawrence <Mike.Lawre...@dal.ca> wrote:
> There are plenty of time series plots demonstrated in the ggplot2 book
> (http://had.co.nz/ggplot2/book/). If you need further help, please ask
> a more detailed question and provide small reproducible examples.
>
> Mike
>
> 2009/6/7 serdar neslihanoglu <snes1...@gmail.com>:

David Winter

unread,
Jun 9, 2009, 1:59:54 AM6/9/09
to ggplot2

> I have already checked the ggplot book but
> thıs book only has tıme serıes lıne graph.
> Moreover , ggplot book never show how to
> draw ACF and Pacf graph of tıme serıes.
> Do you  have another ıdea of tıme serıes graph?
>
> On 8 Haziran, 03:35, Mike Lawrence <Mike.Lawre...@dal.ca> wrote:
>

On Jun 9, 4:25 pm, serdar neslihanoglu <snes1...@gmail.com> wrote:
> ok
> I have already checked the ggplot book but
> thıs book only has tıme serıes lıne graph.
> Moreover , ggplot book never show how to
> draw ACF and Pacf graph of tıme serıes.
> Do you have another ıdea of tıme serıes graph?
>

Hi Serdar (and ggplot people at large, just joined the list...)

I don't think ggplot has anything to calculate ACF/PACF but that's ok,
you can calculate the values with R and plot them with ggplot:

#lh is an example dataset which is a time series
#?acf should let you decide how to handle your data

d <- acf(lh, plot=FALSE)
df <- data.frame(d$lag, d$acf)
p <- ggplot(df, aes(d.lag, d.acf))
p + geom_bar(stat='identity')

I don't know how to make the bars as skinny as ACF plots usually are,
I tought geom_bar(width=....) would do the trick but it doesn't appear
to...

Hope that helps,
David

David Winter

unread,
Jun 12, 2009, 1:47:57 AM6/12/09
to ggplot2
just adding a reply from JiHO that went to me rather than me group so
future google-ers can get the answer :)

>
> I don't know how to make the bars as skinny as ACF plots usually are,
> I tought geom_bar(width=....) would do the trick but it doesn't appear
> to...
>
JiHO said:

For some reason, widths needs to be in a aes call currently.

p + geom_bar(stat='identity', aes(width=0.2))

see:
http://groups.google.com/group/ggplot2/browse_thread/thread/8dd1879200b88e5f/8936478a77ec5a96?lnk=gst&q=Standard+deviation+and+stacked+barcharts#8936478a77ec5a96

JiHO
Reply all
Reply to author
Forward
0 new messages