i've successfully wrote a code that plots the mandelbrot set, but now i try to put different colors according to the iterations before it diverges, but i just can't get it to work. here is my code, i don't know what's wrong with it ...
from math import *
import matplotlib.pyplot as plt
z=complex(0,0)
c=complex(2,2)
X=[]
Y=[]
Z=[]
p=1000
ite=30
a=-(4/p+4j/p)
for m in range(p):
c=complex(2,c.imag+a.imag)
for i in range(p):
c=c+a.real
z=complex(0,0)
b=1
for i in range(ite):
b=b-0.005
z=z**2+c
if abs(z)>2:
break
X=X+[c.real]
Y=Y+[c.imag]
Z=Z+[b/30]
print(round((m/p)*100),"%")
colors = Z
plt.scatter(X,Y,'.',c=[colors])
plt.show()
thanks in advance !