Using ggplot, how to have the x-axis of time series plots set up automatically?

Ggplot2 doesn't support ts-objects: only dates of class date and times of class POSIXct are supported. So you would need to convert your data first to a suitable class.

Ggplot2 doesn't support ts-objects: only dates of class date and times of class POSIXct are supported. So you would need to convert your data first to a suitable class. Have a look at had.co.nz/ggplot2/scale_date.html for examples.

My crude attempt at a function to generate POSIX dates from a ts object, assuming that periods are years: tsdates Mn,1,function(r){paste(r1,r2,'01',sep='/')}) as. POSIXct(dt,tz='UTC') } This can be used with ggplot as: qplot(tsdates(presidents),presidents,geom='line') A more complete solution would need to be able to lay out multiple time series. Also it would be nice to be able to automatically align points according to the time of observation so that we can do things like: qplot(presidents,lag(presidents)).

Ts example. Gnp Date The example above provides the starting date, specifies a monthly frequency and signifies how long of a date vector to create. Hopefully this is helpfully in your data preparation before using ggplot2 or something else.

You can combine the example above into a data. Frame like this: dat Frame(date=new. Date, value=gnp) This can be plotted in ggplot like this: ggplot(data=dat) + geom_line(aes(date, gnp)) All the best, Jay.

To create a dataframe for ggplot you could do something like this: dat Out = length(gnp)), value=gnp ) – Jay Feb 9 '10 at 21:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions