snipt

Ctrl+h for KB shortcuts

Python

Fancy annotation in Matplotlib

1
2
3
annotate(r'$Math Text$',(x,y),
			fontsize=14,va='center',ha='center',color='b',
			bbox = dict(boxstyle="round", color='w',ec="0.5", alpha=1))
https://snipt.net/embed/aa3a5310f616300a4c287ef839294385/
/raw/aa3a5310f616300a4c287ef839294385/
aa3a5310f616300a4c287ef839294385
python
Python
3
2019-08-18T01:33:05
True
False
False
/api/public/snipt/50526/
fancy-annotation-in-matplotlib
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">annotate</span><span class="p">(</span><span class="s1">r&#39;$Math Text$&#39;</span><span class="p">,(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">),</span> </span><span id="L-2"><a name="L-2"></a> <span class="n">fontsize</span><span class="o">=</span><span class="mi">14</span><span class="p">,</span><span class="n">va</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span><span class="n">ha</span><span class="o">=</span><span class="s1">&#39;center&#39;</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="n">bbox</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">boxstyle</span><span class="o">=</span><span class="s2">&quot;round&quot;</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s1">&#39;w&#39;</span><span class="p">,</span><span class="n">ec</span><span class="o">=</span><span class="s2">&quot;0.5&quot;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span> </span></pre></div> </td></tr></table>
"rounded box", Matplotlib, Python, annotation