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

Customize help among groups in argparse
How to read line and remove line in Python?
List of lists; how do I concatenate each value to a new list? [duplicate]
Override operator in two different ways (Python 2.7) [duplicate]
How to get a specific response by using suds module for soap request?
How to find a set of values from a list of lists which contains no repetitions
filter hyperlinks - python
Get movie information from IMDb API website
super() method resolution in python
i need to add time to the python key logger [duplicate]
Python and regex to find a number of length 5
Django REST same API for different countries
How to pass boost::none to Python Quantlib
How to get list from list of list of tuples in python
How can I distribute my python desktop application?
How to load images and labels to image_data_layer using Python?

Categories

HOME
sharepoint
swift
converter
rest
semantic-ui
admin-on-rest
jasmine
cpu-architecture
wxwidgets
memory-leaks
tomcat7
codeeffects
is-empty
appmaker
flyway
webdav
adsense
lotus-notes
flexbox
getorgchart
camera-calibration
onsen-ui2
tee
multiple-monitors
scala-native
cross-platform
google-openid
cython
sql-update
ghost-inspector
onsen-ui
multiplayer
explode
cronet
samsung-mobile
croppic
pipelinedb
branch
image-quality
classpath
cgal
xor
outsystems
superpowered
windows-10-iot-core
google-guava-cache
autocompletetextview
vmd
poco-libraries
visualstudio.testtools
polyfills
restful-url
soundjs
jupyter-console
tripwire
resuming-training
estimation
web-deployment-project
greenhills
udev
slidesjs
jcreator
payu
pdflib
windows-azure-pack
mailcatcher
gameanalytics
magento-1.4
web-essentials
schtasks.exe
hornetq
risk-analysis
google-plus-one
code-first-migrations
uptodate
searchkick
ejabberd-saas
django-1.6
funq
author
mfmailcomposeviewcontroll
codeigniter-a3m
kraken.js
unison
broadcasting
leptonica
execvp
carddav
ienumerator
fraud-prevention
code-conversion
mvccontrib
qsqltablemodel
applicationcontext
datacontract
gtk2hs
testunit
ruby-debug
nagle
hadoop-plugins
external-assemblies
multibyte-functions
integer-promotion

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