# Defining a color scheme from part of a list

I have here an implementation of Newton's method that returns a list of 3-vectors. The first and second elements are the real and imaginary parts of the initial conditions and the third element is the results of Newton's method:

Newton[z_Complex] := z - (z^3 + 1)/(3 z^2);
Table[{n, m , NestWhile[Newton[#] &, n + m I, Abs[#] <= 20 &, All, 50]}, {n, -2, 2, .1}, {m, -2, 2, .1}]


What would be an efficient way of plotting the data and assigning a color depending on the 3rd component of each 3-vector? Could we build the specifications directly into the function ListPlot?

One implementation would be to partition the output into 3 lists of 2-tuples depending on the 3rd component and then use ListPlot on those 3 lists and manually define the color. There must be a better way.

• Have you seen this? Mar 29 '18 at 23:58
• Thx, @J.M., I have looked at this and other locations on this site for creating Newton's Method fractals. Ultimately, I would like to investigate Newton's fractal when the function is Zeta[z]. All of the implementations Ive found here fail for one reason or another. For some reason there is a problem with compile and a basic implementation e.g. mathematica.stackexchange.com/questions/100053/… is too slow to be useful. The above implementation actually works with Zeta[z] but I need to get some control using the output for plotting.
– JEM
Mar 30 '18 at 0:29
• Ah, you definitely can't compile Zeta[], so trying to make a fractal out of that will likely be slow. Mar 30 '18 at 0:36