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

python encode the defined variable from txt file
Tkinter runtime error maximum recursion when open a window
Find out Python version from source code (or Heroku)
Recursive Function named Power
415 error when uploading to API
How to interfacing
Collision detection with PyGame
Why is Python not setting up my cron job's time properly?[Solved]
Training Data Set in NLTK Python
Pip3 packages can't be found/used by the terminal
No recipients have been added when trying to send message with Flask-Mail
Get 503 response code from youtube, when scraping comments with python
Pip can't upgrade a built-in package in ubuntu 15.04
PyRun_SimpleString is blocking whenever import is used, never returns
What is the purpose of setuptools requirements of the form “package===version”
Django admin site not opening while running from pydev in eclipse

Categories

HOME
google-apps-script
cluster-computing
npm
reverse-engineering
jar
drupal-7
label
windows-store-apps
phonegap-cli
algorithmic-trading
filter
file-io
websphere-liberty
proguard
google-spreadsheet-api
lagom
qt-installer
samsung-mobile
shopping-cart
lync-2013
datadog
pygooglechart
svnkit
pari
modelandview
modulo
ios-ui-automation
honeysql
windows-10-iot-core
tic-tac-toe
onbackpressed
constants
powermta
cppunit
matlab-cvst
email-parsing
rapidweaver
chunked-encoding
chrome-remote-desktop
ruby-on-rails-2
etherpad
execl
infinite-scroll
teiid
master
libreadline
spring-ioc
boost-hana
com-interop
achievements
project-online
mpeg-4
twgl.js
mfc-feature-pack
yoothemes
altbeacon
lemoon
plone-3.x
mogrify
pylearn
chaining
activity-streams
tcpreplay
collabnet
mov
sid
mfmailcomposeviewcontroll
factors
visual-studio-addins
exiv2
baucis
windows-mobile-6
convex-polygon
osx-snow-leopard
fogbugz-api
mstsc
fraud-prevention
zend-lucene
wpdb
angularjs-timeout
datarepeater
wcf-web-api
legacy-code
isolatedstorage
ajax.beginform
throttling
coff
dcpu-16
nagle
adobe-contribute
audiostreamer
symbol-server
gwt-2.2-celltable

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