title: How to properly configure coloring for mandelbrot set using python?
body: <p>Looking for trainings on python I decided to draw the mandelbrot set using a script. Drawing it wasn't too complicated so I decided to use color and I discovered the smooth coloring algorithm. Using <a href="https://stackoverflow.com/questions/369438/smooth-spectrum-for-mandelbrot-set-rendering">this question</a> I was able to render something really beautiful and similar to <a href="https://en.wikipedia.org/wiki/Mandelbrot_set#/media/File:Mandel_zoom_00_mandelbrot_set.jpg" rel="nofollow">this one</a>.</p>
  
  <p>To achieve that I set up a gradation color palette using three "steps" : From dark blue to light blue, then light blue to yellow and finally yellow to dark brown. The overall image is perfect.</p>
  
  <p>Problem comes when I try too zoom in. Let's take the example of <a href="https://commons.wikimedia.org/wiki/File:Mandel_zoom_02_seehorse_valley.jpg" rel="nofollow">this area</a>. When I'm at this level of zoom, my script doesn't draw dark blue anymore. I think I mis coded something because whereever you see dark blue on the wikipedia image, I have dark brown (so a color near the end of my palette). When I first thought about this I told myself if the pattern is going back to the original one, then it should use the same colors cause escape time should be the same.</p>
  
  <p><strong>So, was this coloring configured in the palette or is there something about escape time I didn't understand ?</strong></p>
  
  <p>Here is the code I use for the coloring : </p>
  
  <pre><code>def color_pixel(n, z):
      smoothcolor = n + 1 - math.log(math.log(abs(z)))/math.log(2)
      f = smoothcolor/iterate_max
      i = int(f*500)
      color = palette[i]
      return color
  </code></pre>
  
  <p>500 is the number of colors in my palette (<code>len(palette)-1</code>).</p>
  
  <p>z the value of z when it escaped over 10.</p>
  
  <p>I use 100 as the max iterations but same results with a higher value.</p>
  
  <p>Thanks !</p>