How can I colour this Mandelbrot set?
This Mandelbrot set I created works well although I don't know how to colour like other ones on places like Wikipedia. My version is just plain yellow (see below). from graphics import * zoom = 0.1 xOffset = -0.171 yOffset = 0.61 def mandelbrot(spacing, maxIterations, width, height): win = GraphWin("Mandelbrot",width,height) win.setBackground('black') for x in range(0,width,spacing): for y in range(0,height,spacing): a = ((x / width) * zoom) - xOffset b = ((y / height) * zoom) - yOffset pt = Point(x,y) n = 0 coordA = a coordB = b while(n<maxIterations): aa = a * a - b * b bb = 2 * a * b a = aa + coordA b = bb + coordB n+=1 colourR = int(round(n/maxIterations * 255)) colourB = 255-colourR if(abs(a+b) > 2): break pt.setFill(color_rgb(colourR, colourR, 0)) pt.draw(win) mandelbrot(1,2000,700,700) Image:
How to redirect with request context to another url in Django
How do I filter tweets using location AND keyword?
Finding first element occurrence with Python [duplicate]
Sphinx is not able to import anything
How to generate nodes and links from data extracted from a SQLite db table using Python?
Installing libqrencode on windows for python
Keeping the old value when a division by zero occurs
Error in running Scapy Sniff function
Converting a list to a dictionary troubles
pandas groupby numeric functions coerce numeric to object when DataFrame contains object
Python Multiprocessing does not wait
SqlAlchemy and PostgreSql datetime update
How do I use SQLalchemy to treat an existing select object as a view?
Deducting the median from each column
How to correctly instance a IPython cluster made of local and remote machines
Pandas: Efficient way to get first row with element that is smaller than a given value