[R] plot time series data in wide format
Jim Lemon
jim at bitwrit.com.au
Sun Nov 3 04:47:23 CET 2013
On 11/02/2013 11:08 AM, Gary Dong wrote:
> Dear R users,
>
> I wonder if there is a way that I can plot a time series data which is in a
> wide format like this:
>
> CITY_NAME 2000Q1 2000Q2 2000Q3 2000Q4 2001Q1
> 2001Q2 2001Q3 2001Q4 2002Q1 2002Q2
> CITY1 100.5210 101.9667 103.24933 104.0506 104.4317
> 105.3921 106.7643 107.5202 107.2561 107.8184
> CITY2 100.0412 100.6146 103.20293 104.0867 104.6612
> 106.6126 109.3514 110.1943 110.9480 113.0071
> CITY3 99.5895 99.2298 99.26947 99.4101 100.5776
> 101.3719 101.5957 102.2411 103.4390 105.1745
> CITY4 99.6491 101.5386 104.90953 106.1065 108.1785
> 110.6845 113.3746 114.1254 116.2121 119.1033
> CITY5 100.9828 103.6847 105.04793 106.5925 108.7437
> 110.5549 111.9343 112.6704 113.6201 115.3020
>
> Ideally, each city of the five city is represented by a line in the plot.
>
Hi Gary,
I'm not sure that this is exactly what you want, but:
library(plotrix)
# use window() if you are using Windows
x11(width=10,height=5)
bumpchart(garydf[,2:11],rank=FALSE,labels=garydf[,1])
Jim
More information about the R-help
mailing list