[R] Odp: Plot a matrix

Petr PIKAL petr.pikal at precheza.cz
Tue Nov 30 11:33:51 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 30.11.2010 10:52:35:

> 
> Hi,
> 
> I have this MATRIX m:
> 
>                 key
> index               sensor1.A sensor1.B sensor2.A sensor2.B sensor3.A
>   2010-10-1 7:32:00         8        NA         5        NA         2
>   2010-10-3 4:33:21        NA         3        NA         2         1
>   2010-10-5 7:32:00        NA         4        NA         6         7
> 
> m[,0] represents "date"
^^^^^^^
what is this, zero indexing is probably possible but not implemented in 
base R?

> m[,1] represent an "array" of values

Do you really mean array? What are its dimensions?

> also m[,2],m[,3],m[,4],m[,5] represent "arrays" of values
> 
> how can I plot this matrix? I would like to have: 

I am tempted to say to use ?matplot but without knowing what object you 
really have it is rather wild guess. Besides with NA in your data you do 
not get continuous line. See ?lines Details section.

Regards
Petr

> 
> at x axes: "index" (the list of dates)
> and 5 lines (one for each columns sensor1.A sensor1.B sensor2.A 
sensor2.B
> sensor3.A)
> 
> Thanks
> Alberto
> 
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/Plot-a-matrix-
> tp3065094p3065094.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list