# Plot values of an $m\times n$ matrix on the complex plane with color varying along $m$

Let's say I have a complex valued matrix $\begin{pmatrix}1+I&2+2I&3+3I\\4+4I&5+5I&6+6I\end{pmatrix}$ represented by a list:

 list = {{1 + I, 2 + 2 I, 3 + 3 I}, {4 + 4 I, 5 + 5 I, 6 + 6 I}}


I know how to plot each point of the matrix on the complex plane:

Mlist = Table[Table[{Re[list[[i,j]]], Im[list[[i,j]]]}, {i,1,2}], {j,1,3}];

ListPlot[Mlist, PlotRange -> All]


In my case, I have 1000 rows, and I would like 2 things:

• Each point on a given row has the same color

• The color of each row vary regularly along the number of row.

I have no idea how to handle this. Any suggestion?

• Perhaps as a bit of an aside: the same result of your double Table expressions can be achieved by Transpose@ReIm[list]. – MarcoB Mar 9 '16 at 18:18
• What do you mean by "line"? A row in your matrix or a graphical object? – BlacKow Mar 9 '16 at 18:22
• Can you explain the "vary regularly" bit? How would you like the row number to influence the color? Perhaps you could compare what you want with what I proposed in my answer below. – MarcoB Mar 9 '16 at 18:25
• Sorry, I was not very clear. I was not referring to drawing lines. I have 3 values per row, and I want to know how they evolve on the complex plane when the row number increases. That's why I want to have a color code along the number of row. – Julien Roussillon Mar 9 '16 at 18:59

Following your pattern of all points sitting on a straight line.

list = Partition[#, 3] &@(# + I # & /@ Range[12]);
ListLinePlot[#, PlotStyle -> {Blue, Green}, Joined -> False] &@
Map[{Re[#], Im[#]} &, list, {2}]


You can see that the point colors change "regularly" along color list. ReIm[] doesn't work for my version of Mathematica.

Edit

Since you mentioned that you want to track the line number by color, some sort of gradient would be useful. I will use point generation from @MarcoB

SeedRandom[314];
list = RandomComplex[20 {-1 - I, 1 + I}, {10, 3}];
colors = ColorData["TemperatureMap"][#] & /@
Range[0, 1, 1/Length[list]];
ListLinePlot[#, PlotStyle -> colors, Joined -> False] &@
Map[{Re[#], Im[#]} &, list, {2}]


• Thanks for your reply. The thing is that I simplified the matrix, because my matrix has 1000 rows and some "random" complex entries. I'm not sure I can apply this method to my case. Am I wrong? – Julien Roussillon Mar 9 '16 at 19:06
• Just substitute your list in my solution. It will plot points with every row having same color. ListLinePlot[#, PlotStyle -> {Blue, Green}, Joined -> False] &@ Map[{Re[#], Im[#]} &, yourList, {2}] – BlacKow Mar 9 '16 at 19:08
• Thanks a lot, it works! I see a gradient of colors on my points varying with the row number, that's what I wanted to do. – Julien Roussillon Mar 9 '16 at 19:40

Is this along the lines of what you are seeking?

SeedRandom[10]
(newlist = RandomComplex[20 {-1 - I, 1 + I}, {5, 3}]) // MatrixForm
ListLinePlot@ReIm@newlist


• Sorry, I was not very clear. I was not talking about drawing lines, I was referring to the row number on the matrix. In my case I have 3 values per row, and I want to know how they evolve when the row number increase. That's why I want to have a color code. – Julien Roussillon Mar 9 '16 at 18:57