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

How to redirect with request context to another url in Django
How do I filter tweets using location AND keyword?
Finding first element occurrence with Python [duplicate]
Sphinx is not able to import anything
How to generate nodes and links from data extracted from a SQLite db table using Python?
Installing libqrencode on windows for python
Keeping the old value when a division by zero occurs
Error in running Scapy Sniff function
Converting a list to a dictionary troubles
pandas groupby numeric functions coerce numeric to object when DataFrame contains object
Python Multiprocessing does not wait
SqlAlchemy and PostgreSql datetime update
How do I use SQLalchemy to treat an existing select object as a view?
Deducting the median from each column
How to correctly instance a IPython cluster made of local and remote machines
Pandas: Efficient way to get first row with element that is smaller than a given value

Categories

HOME
swift
laravel-5
answer-set-programming
meshlab
paramiko
facebook-graph-api
translation
actionscript
couchdb-2.0
console
sequelize.js
httpclient
xamarin-studio
camera-calibration
data-analysis
sql-tuning
off-canvas-menu
derived
koa
flexboxgrid
plsqldeveloper
facebook4j
header-files
bcrypt
gpib
graph-databases
hawtio
precedence
pox
sidr
shibboleth
color-scheme
mmdrawercontroller
jboss-esb
dql
duktape
jquery-multidatespicker
dojox.mobile
mod-fcgid
scalafx
lumen-5.3
pinvoke
tiddlywiki
workflow-foundation-4.5
iphone-developer-program
search-box
shinyjs
verbose
gradle-script-kotlin
push-diffusion
mongoose-populate
unsatisfiedlinkerror
jackson-databind
freefem++
usb-drive
fill
galaxy
void
throughput
sourcegear-vault
jericho-html-parser
subversion-edge
jython-2.7
chaining
jcr-sql2
x-ua-compatible
ghostdoc
funkload
codeigniter-a3m
httpcontext
dvcs
db4o
edit-in-place
installshield-2011
javascriptmvc
gridworld
client-side-scripting
manage.py
magickwand
htmltextwriter
process-monitor
snapjs
cgpath
attachevent
shim
signals2
point-sprites
separation-of-concerns
jquery-selectbox
throttling
shared-objects
tcxgrid
opengl-es-lighting
phpcrawl
search-path
grooveshark
callgrind
revision
longjmp
interface-design

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