[R] spaghetti plots in R
Rui Barradas
rui1174 at sapo.pt
Wed Apr 4 19:51:00 CEST 2012
Hello,
uday wrote
>
> Hi Liviu ,
> now I can see that function but the problem is that its only applicable
> for single data frame. as I wrote in my first post that I got 2 different
> matrix with same dimensions ( 3x 12 here in example) , so if I plot normal
> plot using plot function
> plot(ak[1,],pre[1,],type="l")
> lines(ak[2,],pre[2,],type="l",col="red")
>
> but every files contains more than 1000 observations.
> Is it possible to use this function for two different matrix data ?
>
> if yes then please let me know how to do it .
>
>
> Thanks
> Uday
>
Why not ?matplot - "Plot the columns of one matrix against the columns of
another. "
ak <- as.matrix(read.table(text="
0.3211745 0.4132568 0.5649930 0.6920562 0.7760113 0.8118568 0.8609301
0.9088819 0.9326736 0.9605178 1 1.003940
0.3159234 0.4071270 0.5579212 0.6844584 0.7684690 0.8243702 0.8677043
0.8931288 0.9261926 0.9647617 1 1.012930
0.3075260 0.3993699 0.5493242 0.6765600 0.7614591 0.8127050 0.8537816
0.8884786 0.9343690 0.9618874 1 1.007103
"))
ak
pre <- as.matrix(read.table(text="
10.34615 52.02116 146.1736 243.2864 347.4150 431.6711 521.4271 629.0045
729.9594 827.8628 921.5508 956.4445
10.34615 52.02539 146.3670 244.3871 350.1785 454.6706 546.5499 638.3344
741.9849 842.5700 953.9648 995.8201
10.34615 52.02754 146.4656 244.9480 351.5865 457.1768 550.1341 643.0880
748.1114 850.0670 951.6384 987.9105
"))
matplot(t(ak), t(pre), type="l")
Note that t() was needed.
Hope this helps,
Rui Barradas
--
View this message in context: http://r.789695.n4.nabble.com/spaghetti-plots-in-R-tp4532021p4532706.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list