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 sklearn non linear svm penalty
builtins.TypeError: __init__() missing 2 required positional arguments: 'height' and 'radius'
How to do a reverse operation to tf.nn.embedding_lookup?
django complex query for interdependant tables
Is there a more efficient and elegant way to filter pandas index by date?
How do I temporarily use Python 3.6 in terminal Mac?
Difference between pre-trained word embedding and training word embedding in keras
AttributeError: module 'xlwings' has no attribute 'save'
Images broadcast over UDP socket (Python)
Index class as list and as dictionary
Python “will the arrow fly straight program”
Processing an eventlog with Pandas - find next match in DataFrame
Intellij python plugin debugging the script copied under the target directory
Create a list with repeated values with list comprehension
Is LASSO regression implemented in Statsmodels?
There is a duplicate line showed when calling a __init__ in Python script

Categories

HOME
sql-server
winapi
wmic
ipython
smartphone
wms
concourse
h2
orientation
apple-numbers
value
constructor
onsen-ui2
dryioc
mongodb-query
cross-platform
rhapsody
jquery-form-validator
qsub
activepython
google-api-dotnet-client
pcre
thinking-sphinx
dd-wrt
jackson-dataformat-csv
ioc-container
twitter-bootstrap-2
pari
idl
recurrence-relation
geomesa
openshift-enterprise
broadleaf-commerce
nodeclipse
ntfs-mft
fax
agent
knockout-3.0
median
bids
prototypejs
dojox.grid.datagrid
jtds
walmart-electrode
windows-firewall
web-deployment-project
livescribe
applepayjs
rhel6
udev
redux-router
ingres
sql-import-wizard
tomee
software-product-lines
tuxedo
uiprogressview
windows-nt
project-online
altbeacon
lemoon
geodjango
app.xaml
playscape
on-duplicate-key
xjc
google-plus-one
code-first-migrations
es2015
start-job
libsndfile
gyroscope-framework
kendo-mvvm
and-operator
dalekjs
dache
cppdepend
joox
facebook-chat
sqljdbc
cdata
leptonica
swrl
ruboto
gridworld
grunt-contrib-compass
mailcore
xslkey
appfog
vertical-scrolling
pascals-triangle
bulbs
ubuntu-11.10
linkedhashset
xgettext
n-layer
objective-c-protocol
nssavepanel
goliath
posting
adobe-contribute
squeel
drawtext
surefire
delegatecommand
google-instant
linfu
web-statistics

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