大概就像下图所示的样子
<code class="language-matlab"><span class="n">t</span> <span class="p">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">:.</span><span class="mi">02</span><span class="p">:</span><span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="nb">pi</span><span class="p">;</span> <span class="n">r</span> <span class="p">=</span> <span class="mi">0</span><span class="p">:.</span><span class="mi">02</span><span class="p">:</span><span class="mi">1</span><span class="p">;</span> <span class="n">pcolor</span><span class="p">(</span><span class="nb">cos</span><span class="p">(</span><span class="n">t</span><span class="p">)</span><span class="o">'*</span><span class="n">r</span><span class="p">,</span><span class="nb">sin</span><span class="p">(</span><span class="n">t</span><span class="p">)</span><span class="o">'*</span><span class="n">r</span><span class="p">,</span><span class="n">t</span><span class="o">'*</span><span class="p">(</span><span class="n">r</span><span class="o">==</span><span class="n">r</span><span class="p">))</span> <span class="n">colormap</span><span class="p">(</span><span class="n">hsv</span><span class="p">(</span><span class="mi">256</span><span class="p">)),</span> <span class="n">shading</span> <span class="n">interp</span><span class="p">,</span> <span class="n">axis</span> <span class="n">image</span> <span class="n">off</span> </code>
<code class="language-python"><span class="c"># -*- coding:utf-8 -*-</span> <span class="kn">from</span> <span class="nn">pylab</span> <span class="kn">import</span> <span class="o">*</span> <span class="n">center</span> <span class="o">=</span> <span class="p">(</span><span class="mi">250</span><span class="p">,</span> <span class="mi">250</span><span class="p">)</span> <span class="n">radius</span> <span class="o">=</span> <span class="mi">250</span> <span class="n">img</span> <span class="o">=</span> <span class="n">zeros</span><span class="p">((</span><span class="mi">500</span><span class="p">,</span><span class="mi">500</span><span class="p">))</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">500</span><span class="p">):</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">500</span><span class="p">):</span> <span class="n">x</span> <span class="o">=</span> <span class="n">i</span> <span class="o">-</span> <span class="n">center</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="mf">1.0</span> <span class="n">y</span> <span class="o">=</span> <span class="n">j</span> <span class="o">-</span> <span class="n">center</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">*</span> <span class="mf">1.0</span> <span class="k">if</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">+</span><span class="n">y</span><span class="o">**</span><span class="mi">2</span> <span class="o"> <span class="n">radius</span><span class="o">**</span><span class="mi">2</span><span class="p">:</span> <span class="k">if</span> <span class="n">x</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> <span class="n">img</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">arctan</span><span class="p">(</span><span class="n">y</span><span class="o">/</span><span class="n">x</span><span class="p">)</span> <span class="k">elif</span> <span class="n">x</span><span class="o"><span class="mi">0</span> <span class="ow">and</span> <span class="n">y</span><span class="o">>=</span><span class="mi">0</span><span class="p">:</span> <span class="n">img</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">arctan</span><span class="p">(</span><span class="n">y</span><span class="o">/</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">pi</span> <span class="k">elif</span> <span class="n">x</span><span class="o"><span class="mi">0</span> <span class="ow">and</span> <span class="n">y</span><span class="o"><span class="mi">0</span><span class="p">:</span> <span class="n">img</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">arctan</span><span class="p">(</span><span class="n">y</span><span class="o">/</span><span class="n">x</span><span class="p">)</span> <span class="o">-</span> <span class="n">pi</span> <span class="k">elif</span> <span class="n">x</span><span class="o">==</span><span class="mi">0</span> <span class="ow">and</span> <span class="n">y</span><span class="o">></span><span class="mi">0</span><span class="p">:</span> <span class="n">img</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">pi</span> <span class="o">/</span> <span class="mi">2</span> <span class="k">elif</span> <span class="n">x</span><span class="o">==</span><span class="mi">0</span> <span class="ow">and</span> <span class="n">y</span><span class="o"><span class="mi">0</span><span class="p">:</span> <span class="n">img</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">pi</span> <span class="o">/</span> <span class="o">-</span><span class="mi">2</span> <span class="k">elif</span> <span class="n">x</span><span class="o">==</span><span class="mi">0</span> <span class="ow">and</span> <span class="n">y</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span> <span class="n">img</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span> <span class="k">print</span> <span class="n">img</span> <span class="n">imshow</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">cmap</span><span class="o">=</span><span class="n">cm</span><span class="o">.</span><span class="n">hsv</span><span class="p">)</span> <span class="n">show</span><span class="p">()</span> </span></span></span></span></span></code>
<code class="language-python"><span class="kn">from</span> <span class="nn">pylab</span> <span class="kn">import</span> <span class="o">*</span> <span class="n">n</span><span class="o">=</span><span class="mi">300</span> <span class="n">img</span><span class="o">=</span><span class="p">[[</span><span class="n">arctan2</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">)</span> <span class="k">if</span> <span class="n">x</span><span class="o">*</span><span class="n">x</span><span class="o">+</span><span class="n">y</span><span class="o">*</span><span class="n">y</span><span class="o"><span class="n">n</span><span class="o">*</span><span class="n">n</span> <span class="k">else</span> <span class="mi">0</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="o">-</span><span class="n">n</span><span class="p">,</span><span class="n">n</span><span class="p">)]</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="o">-</span><span class="n">n</span><span class="p">,</span><span class="n">n</span><span class="p">)]</span> <span class="n">imshow</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">cmap</span><span class="o">=</span><span class="n">cm</span><span class="o">.</span><span class="n">hsv</span><span class="p">)</span> <span class="n">show</span><span class="p">()</span> </span></code>
<code class="language-text">n=300; c=Hue[i/n]; Graphics@Table[{c,EdgeForm@c,Disk[{0,0},1,2Pi/n{i-1,i}]},{i,n}] </code>