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 choose python version accordingly in pycharm?
Unable to import Flask to Kivy iOS
Unique list without spliting entries based on spaces in python
Uncaught SyntaxError: Unexpected token & error for flask and html
Django celery tasks working very long
Python, create plot from DataFrame
having this error TypeError: cannot concatenate 'str' and 'int' objects when trying to do math with variables stored with pickle
Pygame Tone Generator [duplicate]
Django - custom userprofile NoSuchTable error
How do you name a new instance of a class when you don't know what the name is in advance? [duplicate]
python podSixNet - data not sent from server to client
How can I press the Enter key on Selenium using Python without finding an element?
while creating the runbook as draft using azure REST api in python i am facing the error…!
Pick a free port number on localhost using Python, but avoid 1 specific port number
Python split dictionary key at comma
Python-pptx for Python 3.5.1

Categories

HOME
json
security
ssas-2012
reverse-engineering
wmic
google-contacts
label
parse-server
algorithmic-trading
uiactivityviewcontroller
viber
local
line-api
ejs
spring-cloud-config
opera-mini
uicollectionview
zope
zoomcharts
ada
google-openid
ios10.3
deb
embedly
jquery-form-validator
csh
tfs2013
compare-and-swap
data-cleansing
bus-error
version-numbering
web-frontend
pentaho-report-designer
xilinx-ise
hibernate-cache
apache-cloudstack
helix-3d-toolkit
skygear
npm-shrinkwrap
passenger
swagger-editor
dart-pub
taglib
facebook-chatbot
rdw
recycle-bin
nstouchbar
istorage
jenkins-jira-trigger
webdatagrid
mouseclick-event
windows-95
rpostgresql
fontconfig
adler32
barcode-printing
cfeclipse
audioqueue
excon
uiprogressview
scalar
linkageerror
asteriskami
soda
inotifypropertychanged
string-parsing
sun-codemodel
bluesnap
acm
insertion-sort
data-import
wikitext
unity5.3
site-prism
p-np
sevenzipsharp
programming-paradigms
castle-windsor-3
subversion-edge
start-job
python-ggplot
candidate-key
ultrawingrid
sthttprequest
dache
adaptive-compression
bsp
wss
sgml
config-files
broadcasting
.net-cf-3.5
ruboto
resgen
fortran77
graph-coloring
xml-libxml
angularjs-timeout
cgpath
attachevent
returnurl
n-layer
expression-evaluation
ninject-extensions
maven-ant-tasks
flash-cs5.5
flexicious
charts4j
ets
chatroom
mvccontrib-grid
file-encodings
plinq
openwysiwyg
evb
gears





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android


MS Developer
developer works
python
ios
c
html
jquery


RDBMS discuss