Colormapping the Mandelbrot set by iterations in python -


i using np.ogrid create x , y grid drawing values. have tried number of different ways color scheme according iterations required |z| >= 2 nothing seems work. when iterating 10,000 times sure have clear picture when zooming, cannot figure out how color set according iteration ranges. here code using, of structure borrowed tutorial. suggestions?

#i found function , searched in numpy best usage type of density plot x_val, y_val = np.ogrid[-2:2:2000j, -2:2:2000j]  #creating values work during iterations c = x_val + 1j*y_val z = 0 iter_num = int(input("please enter number of iterations:"))  n in range(iter_num):     z = z**2 + c     if n%10 == 0:         print("iterations left: ",iter_num - n)  #creates mask filter out values of |z| > 2 z_mask = abs(z) < 2 proper_z_mask = z_mask - 255 #switches current black/white pallette #creating figure , sizing optimal viewing on small laptop screen plt.figure(1, figsize=(8,8)) plt.imshow(z_mask.t, extent=[-2, 2, -2, 2]) plt.gray() plt.show() 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -