<divid="unreleased-message"> You are reading an old version of the documentation (v3.2.2). For the latest version see <ahref="https://matplotlib.org/stable/devel/MEP/MEP29.html">https://matplotlib.org/stable/devel/MEP/MEP29.html</a></div>
<h2><aclass="toc-backref" href="#id2">Branches and Pull requests</a><aclass="headerlink" href="#branches-and-pull-requests" title="Permalink to this headline">¶</a></h2>
<p>None at the moment, proof of concept only.</p>
</div>
<divclass="section" id="abstract">
<h2><aclass="toc-backref" href="#id3">Abstract</a><aclass="headerlink" href="#abstract" title="Permalink to this headline">¶</a></h2>
<p>This MEP proposes to add lightweight markup to the text artist.</p>
</div>
<divclass="section" id="detailed-description">
<h2><aclass="toc-backref" href="#id4">Detailed description</a><aclass="headerlink" href="#detailed-description" title="Permalink to this headline">¶</a></h2>
<p>Using different size/color/family in a text annotation is difficult because the
<codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">text</span></code> method accepts argument for size/color/family/weight/etc. that are used
for the whole text. But, if one wants, for example, to have different colors,
one has to look at the gallery where one such example is provided:
<p>This example takes a list of strings as well as a list of colors which makes it
cumbersome to use. An alternative would be to use a restricted set of <aclass="reference external" href="https://developer.gnome.org/pygtk/stable/pango-markup-language.html">pango</a>-like markup and to interpret this markup.</p>
<h2><aclass="toc-backref" href="#id5">Implementation</a><aclass="headerlink" href="#implementation" title="Permalink to this headline">¶</a></h2>
<p>A proof of concept is provided in <aclass="reference external" href="https://github.com/rougier/matplotlib/blob/markup/examples/text_labels_and_annotations/markup.py">markup_example.py</a> but it currently only handles the horizontal direction.</p>
<divclass="section" id="improvements">
<h3><aclass="toc-backref" href="#id6">Improvements</a><aclass="headerlink" href="#improvements" title="Permalink to this headline">¶</a></h3>
<ulclass="simple">
<li>This proof of concept uses regex to parse the text but it may be better
to use the html.parser from the standard library.</li>
<li>Computation of text fragment positions could benefit from the OffsetFrom
class. See for example item 5 in <aclass="reference external" href="http://matplotlib.org/devdocs/tutorials/text/annotations.html#using-complex-coordinates-with-annotations">Using Complex Coordinates with Annotations</a></li>
</ul>
</div>
<divclass="section" id="problems">
<h3><aclass="toc-backref" href="#id7">Problems</a><aclass="headerlink" href="#problems" title="Permalink to this headline">¶</a></h3>
<ul>
<li><pclass="first">One serious problem is how to deal with text having both latex and
html-like tags. For example, consider the following:</p>
<p>Recommendation would be to have mutual exclusion.</p>
</li>
</ul>
</div>
</div>
<divclass="section" id="backward-compatibility">
<h2><aclass="toc-backref" href="#id8">Backward compatibility</a><aclass="headerlink" href="#backward-compatibility" title="Permalink to this headline">¶</a></h2>
<p>None at the moment since it is only a proof of concept</p>
</div>
<divclass="section" id="alternatives">
<h2><aclass="toc-backref" href="#id9">Alternatives</a><aclass="headerlink" href="#alternatives" title="Permalink to this headline">¶</a></h2>
<p>As proposed by @anntzer, this could be also implemented as improvements to