File:Mandelbrot set, plotted with Matplotlib, zoomed.svg

Summary

Description
English: A zoomed-in view of the Mandelbrot set (100 iterations), plotted with Python/Matplotlib. Also see File:Mandelbrot set, plotted with Matplotlib.svg for the whole set.
Date
Source Own work
Author Morn
SVG development
InfoField
Source code
InfoField

Python code

Source code
from pylab import *
from numpy import NaN

#xmin, xmax, ymin, ymax = -2, 0.8, -1.5, 1.5
xmin, xmax, ymin, ymax = -.7, -.4, .45, .7
max_it = 100    # maximum number of iterations
px     = 3000	# vertical lines
res    = (ymax - ymin) / px   # grid resolution

figure(figsize = (10, 10))

def m(c):
	z = 0
	for n in range(1, max_it + 1):
		z = z**2 + c
		if abs(z) > 2:
			return n
	return NaN

X = arange(xmin, xmax + res, res)
Y = arange(ymin, ymax + res, res)
Z = zeros((len(Y), len(X)))

for iy, y in enumerate(Y):
	print (iy + 1, "of", len(Y))
	for ix, x in enumerate(X):
		Z[-iy - 1, ix] = m(x + 1j * y)

save("mandel", Z)	# save array to file

imshow(Z, cmap = plt.cm.prism, interpolation = 'none',
  extent = (X.min(), X.max(), Y.min(), Y.max()))
xlabel("Re(c)")
ylabel("Im(c)")
savefig("mandelbrot_python2.svg")
show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Mandelbrot%20set,%20plotted%20with%20Matplotlib,%20zoomed.svg
Category:Self-published work Category:Mandelbrot sets (detail) Category:SVG fractals
Category:CC-Zero Category:Mandelbrot sets (detail) Category:SVG fractals Category:Self-published work Category:Valid SVG created with Matplotlib code