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

numpy.minimum applied to pandas DataFrame and Series
Find the area of a bounding polygon that encloses a set of points
Stacking Images in a Python graph
Deleting a directory if it doesn't contain a file of specific type (Python)
Python: efficiently checking a file line by line
How to read a text file and group them in tuple?
Python importing files - for loops
How to avoid docstring duplication
python script is not executed via crontab
Pandas dataframe.to_csv() returns each row in quotes
Avoiding Stack Overflow in Python 3. Advice needed
ld cannot find .so libraries
Converting multi-line String to Dict in Python
passing structure from c++ to python
MySQL string replace using SQLAlchemy
How to copy an image from server directory to another directory in python

Categories

HOME
cluster-computing
cil
plsql
erlang
tinyos
matplotlib
zend-framework2
defragmentation
dropbox
pjsip
google-shopping
xul
gatsby
qt-installer
equalizer
scala-native
jquery-terminal
aspell
alfresco-share
cairo
arraylist
quartus
jpeg2000
jsonserializer
styles
profile
jquery-scrollify
qsub
printdocument
visual-c++-2017
ab-initio
solidworks
pcre
thinking-sphinx
dhtmlx-scheduler
gpib
consumer
backup-strategies
pyscripter
preg-grep
spreedly
receipt
geo
geopy
body-parser
von-neumann
vsts-package-management
dart-pub
tripwire
microdata
tango
lftp
finite-element-analysis
resuming-training
cppunit
azure-availability-set
nsjsonserialization
jenkins-jira-trigger
workflow-foundation-4.5
crystal-reports-8.5
search-box
jszip
castle-dynamicproxy
sqlexception
pspice
packagemaker
django-filer
dojox.charting
boost-hana
jackson-databind
spatial-query
faraday
date-format
axes
datainputstream
schtasks.exe
wikitext
sourcegear-vault
futuretask
mogrify
twython
custom-url
musl
tilestache
adcolony
alpha-transparency
proxies
colt
indexing-service
ksoap2
svcutil.exe
lov
operations
exiv2
bigint
installshield-2011
installshield-2009
javascriptmvc
visual-studio-2003
justgage
nuspec
fileconveyor
mvs
radchart
continuous-testing
supersized
maven-ant-tasks
wchar
shared-objects
scraperwiki
surefire
clients
webrat
savestate
visual-studio-dbpro

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