File:Julia set, plotted with Matplotlib.svg

Summary

Description
English: The Julia set plotted with Matplotlib. The seed coordinates are (-0.512511498387847167, 0.521295573094847167), the same as for File:Julia set (red).png.
Date
Source Own work
Author Morn
SVG development
InfoField
Source code
InfoField

Python code

Source code
from pylab import *
from numpy import NaN
from matplotlib.colors import LogNorm

# seed parameter from https://commons.wikimedia.org/wiki/File:Julia_set_%28red%29.png
s = -0.512511498387847167, 0.521295573094847167

res = .001    # grid resolution
max_it = 1000 # maximum number of iterations

figure(figsize = (10, 7))

def jul(a):
	z = a
	for n in range(1, max_it + 1):
		z = z**2 + s[0] + 1j * s[1]
		if abs(z) > 2:
			return n
	return NaN

X = arange(-2, 2 + res, res)
Y = arange(-1.5,  1.5 + 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] = jul(x + 1j * y)

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

imshow(Z, cmap = plt.cm.viridis, interpolation = 'none', norm = LogNorm(),
  extent = (X.min(), X.max(), Y.min(), Y.max()))
xlabel("Re(z)")
ylabel("Im(z)")
axis((-1.5, 1.5, -1, 1))
savefig("julia_python.svg")
show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Julia%20set,%20plotted%20with%20Matplotlib.svg
Category:Self-published work Category:Disconnected Julia sets Category:Fractals with point symmetry Category:SVG fractals Category:Quadratic Julia sets
Category:CC-BY-SA-4.0 Category:Disconnected Julia sets Category:Fractals with point symmetry Category:Quadratic Julia sets Category:SVG fractals Category:Self-published work Category:Valid SVG created with Matplotlib code