python


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:

Related Links

List circulation in Python for Project Euler 37
Python lists, pairing and writting
searching sickbeard api output and print only keyword line
Flask-Restless API Endpoints only work sometimes
Matplotlib tight_layout causing RuntimeError
Strange behaviour of ref counter with ints being 0
self.assertTrue(post.text in response.content) – Assertion Error
How to add a path to sys.path permanently [duplicate]
Copy C structure to Python List
python error:List index out of range
While loop inside for loop?
Serialize multiple models in a single view
Iterating over a list adding attributes to an object in Python [duplicate]
Fourier Transformation vs Numpy FFT
pandas to_html no value representation
Using Pandas To Find the Number Of Periods Since the Rolling High

Categories

HOME
json
numpy
app-inventor
vhdl
puzzle
ubuntu-16.04
command
ruby-on-rails-3
matplotlib
apache2
snap.svg
user
apiconnect
keystore
nixos
ssr
flann
uiview
scala-native
cross-platform
bar-chart
ada
off-canvas-menu
ejbca
device-detection
plupload
koa
google-maps-android-api-2
compare-and-swap
pipelinedb
continuous-deployment
mef2
owl-api
configure
datadog
consumer
wfp
discord.net
declare
ssh.net
jrules
tango
openweathermap
walmart-electrode
seamless-immutable
unity3d-editor
collapsingtoolbarlayout
bettercms
sqldatareader
pdflib
uistackview
audioqueue
django-filer
contour
spring-lemon
mpeg-4
spinlock
test-class
datainputstream
direct3d12
hyperthreading
document-oriented-db
abas
on-duplicate-key
consensus
sqoop2
obfuscar
qtestlib
hidden-field
neoload
wss
internal
roxygen
nsmatrix
vertical-rhythm
goinstant
astyanax
sttwitter
adomd.net
dynamics-ax-2009
datarepeater
caliper
windows-phone-7-emulator
parameterization
hibernate3
emacs23
gethashcode
hibernate3-maven-plugin
revert
winverifytrust

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App