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

Migrating python with selenium from mac to pc
Is there a Haskell equivalent to Python's `shelve` for transparent persistence?
Module object differences in 2 versions of Sublime Text
Python's function scope [duplicate]
MultiIndex from product of unique values of two indexes
Sorting a list of jagged (non-normal) tuples in python [duplicate]
Python - calculator program and strings
how can the qml files in qrc import plugins
PySide / Qt Import Error
How do you execute a terminal command and then repeatedly check and store the response in Python?
Grouping unique items in a python list when only equality comparison is possible
How to loop this so I can add more twitter accounts
flask sub function not yielding results
Django - Rest-framework: After Deployment to a remote server wrong results
PythonAnywhere install new module for 2.7
How to extract substring with base part of path string

Categories

HOME
swift
sql-server
mapping
nuxeo
ocaml
d
rocketmq
apple-numbers
gspread
packer
oclint
ssr
cosmicmind
equalizer
cross-platform
python-unicode
factor-analysis
attask
k2
spring-test
bcrypt
nmf
compare-and-swap
emv
mef2
vcard
dpi
pitest
clockwork
read-write
edb
hotmail
shapes
ios-ui-automation
service-locator
parse-android-sdk
concrete5-5.7
productivity
powermta
amd
web-deployment-project
multi-agent
rollback
slot
crystal-reports-8.5
heroku-postgres
httplib2
launch
mercury
adler32
festival
vici
pdfkit
alter
chessboard.js
update-site
pydio
mailcatcher
cron-task
spark-cassandra-connector
fps
amazon-kcl
insert-into
urn
team-build
moai
planetary.js
unison
convex-polygon
facebook-sdk-3.1
ng-hide
windows-update
carddav
justgage
objcmongodb
tridion2009
cbcentralmanager
css-tables
n-layer
fotoware
webkit-transform
easygui
paintcomponent
ruby-debug
sitemappath
gwt-2.2-celltable
pci-bus
system-codedom-compiler
interface-design
associativity





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