Mandelbrot set: Difference between revisions

Content added Content deleted
m (→‎{{header|Python}}: Minor cosmetic change)
m (→‎{{header|Python}}: Code shortened by two lines)
Line 6,394: Line 6,394:
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt


d = 100 # pixel density
d, n = 100, 50 # pixel density & number of iterations
r = 2.5 # escape radius (must be greater than 2)
n = 50 # number of iterations
r = 2.5 # escape radius (must be greater than 2)


x = np.linspace(-2.5, 1.5, 4*d+1)
x = np.linspace(-2.5, 1.5, 4*d+1)
Line 6,412: Line 6,411:
T[M] = k + 1
T[M] = k + 1


plt.figure(dpi=200)
plt.imshow(T, cmap=plt.cm.twilight_shifted)
plt.imshow(T, cmap=plt.cm.twilight_shifted)
plt.savefig('mandelbrot.png')</lang>
plt.savefig('mandelbrot.png', dpi=200)</lang>


=={{header|R}}==
=={{header|R}}==