import pylab
x0_default = -2
y0_default = -1.5
side_default = 3.0
side = side_default
x0 = x0_default
y0 = y0_default
options = ['Reset','Upper Left', 'Upper Right', 'Stay', 'Lower Left', 'Lower Right']
@interact
def show_mandelbrot(option = selector(options, nrows = 2, width=8),
N = slider(100, 1000,100, 300),
L = slider(20, 300, 20, 60),
plot_size = slider(2,10,1,6),
auto_update = False):
global x0, y0, side
if option == 'Lower Right':
x0 += side/2
y0 += side/2
elif option == 'Upper Right':
y0 += side/2
elif option == 'Lower Left':
x0 += side/2
if option=='Reset':
side = side_default
x0 = x0_default
y0 = y0_default
elif option != 'Stay':
side = side/2
time m=mandelbrot_cython(x0 ,x0 + side ,y0 ,y0 + side , N, L )
pylab.clf()
pylab.imshow(m, cmap = pylab.cm.gray)
time pylab.savefig('mandelbrot.png')
|
|
Click to the left again to hide and once more to show the dynamic interactive window
|