1 # contributed by Stephen Phillips
5 # Mandelbrot parameters
15 re_step
= (re_max
- re_min
) / gridx
16 im_step
= (im_max
- im_min
) / gridy
20 for re_index
in range(gridx
):
21 re
= re_min
+ re_step
* (re_index
+ 0.5)
22 for im_index
in range(gridy
):
23 im
= im_min
+ im_step
* (im_index
+ 0.5)
27 while n
< max_iter
and abs(z
) < 2:
30 d
.append([re
- 0.5 * re_step
, re
+ 0.5 * re_step
,
31 im
- 0.5 * im_step
, im
+ 0.5 * im_step
,
35 g
= graph
.graphxy(height
=8, width
=8,
36 x
=graph
.axis
.linear(min=re_min
, max=re_max
, title
=r
'$\Re(c)$'),
37 y
=graph
.axis
.linear(min=im_min
, max=im_max
, title
=r
'$\Im(c)$'))
38 g
.plot(graph
.data
.list(d
, xmin
=1, xmax
=2, ymin
=3, ymax
=4, color
=5),
39 graph
.style
.rect(color
.palette
.Rainbow
))
40 g
.dodata() # plot data first, then axes
41 g
.writeEPSfile('mandel')