Question: how to use listplot on matrix?

again, I wish Maple help can be better. A simple example of how to use listplot on matrix is all what is needed.

I have a matrix, 3 rows and 5 columns. I need to use listplot to generate 3 listplots on same graph. I can do this one row at a time. But when calling listplot(m) where m is the matrix, it gives error

Error, (in plots:-pointplot) incorrect number of coordinates in points data

Clicking on the above link, as usual sends me to page that says There is no help page available for this error

Help says

The listplot command also accepts a list or Matrix containing points data. great. But how?? I click on the link next to the above line, it sends me to page about pointplot. There is says that pointplot also accepts a matrix of size n by 2. Does this mean listplot matrix must also be two columns? It does not say this on the listplot help page.

For a workaround, I now generate plot of each row on its own, then use display to put them all on same graph. But the problem with this is that all have same color. I was hoping that if Maple did it all at once, it will automatically pick different color for each line as is the case with Mathematica (example below)

Is there a better way to do this? For reference, I'd like to generate similar plot like this

You see, the colors are automatically selected. With manual plotting of each row myself, I have to select the color myself and to make sure they are different and so on. It will be better if the system did all of this.

Please see attached worksheet

restart;

m:=Matrix([[1,2,5,6,9],[3,4,5,13,14],[1,3,4,10,11]])

Matrix(3, 5, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 5, (1, 4) = 6, (1, 5) = 9, (2, 1) = 3, (2, 2) = 4, (2, 3) = 5, (2, 4) = 13, (2, 5) = 14, (3, 1) = 1, (3, 2) = 3, (3, 3) = 4, (3, 4) = 10, (3, 5) = 11})

plots:-listplot(m); #why this fail?

Error, (in plots:-pointplot) incorrect number of coordinates in points data

plots:-listplot(m[1,..])

#for a workaround, I can do this. But now all lines have same color which is not good.
map(n->plots:-listplot(m[n,..]),[$1..3]):
plots:-display(%)

 

Download how_to_list_plot_matrix.mw

What is the correct way to use listplot with matrix?

Please Wait...