1
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Perhaps as a bit of an aside: the same result of your double Table expressions can be achieved by Transpose@ReIm[list]. $\endgroup$ – MarcoB Mar 9 '16 at 18:18
  • $\begingroup$ What do you mean by "line"? A row in your matrix or a graphical object? $\endgroup$ – BlacKow Mar 9 '16 at 18:22
  • $\begingroup$ 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. $\endgroup$ – MarcoB Mar 9 '16 at 18:25
  • $\begingroup$ 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. $\endgroup$ – Julien Roussillon Mar 9 '16 at 18:59
3
$\begingroup$

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}]

enter image description here

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}]

enter image description here

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Julien Roussillon Mar 9 '16 at 19:06
  • $\begingroup$ 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}] $\endgroup$ – BlacKow Mar 9 '16 at 19:08
  • $\begingroup$ 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. $\endgroup$ – Julien Roussillon Mar 9 '16 at 19:40
3
$\begingroup$

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

Mathematica graphics

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Julien Roussillon Mar 9 '16 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.