[R] Line chart with a double matrix

ramonovelar ramon.ovelar at gmail.com
Thu Jul 19 16:50:58 CEST 2012


I have a double matrix that I want to represent in a line chart. Although I
have seen some examples I still don't manage to get it. My data is this (a
double matrix called mymatrix) :

            Blogs Wikis Redes Etiq.   SPC   LMS
Menor de 30 57.14 28.57 14.29 28.57 57.14 28.57
de 31 a 40  63.83 61.70 29.79 17.02 59.57 70.21
de 41 a 50  72.64 70.75 47.17 20.75 55.66 75.47
Mayor de 51 62.07 58.62 48.28 17.24 50.00 67.24

As I understand from  http://www.statmethods.net/graphs/line.html this
example  (see bottom of the page), I have to set the plot and then run a
loop to draw every line.  But:

1) If I do
plot(range(mymatrix), type ="l")

The width of the plot is very small, I just get two columns inside.
Actually, It would like to put the colnames at the bottom of the plot, as
labels and a I would like to calculate the width of the plot to adjust to my
six columns.

2) I don't know how to make a loop for each row of the matrix. Something
like "for (row in mymatrix).

Thanks in advance for any help.

View this message in context: http://r.789695.n4.nabble.com/Line-chart-with-a-double-matrix-tp4637047.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list