<p dir="auto">In <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="113060845" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/5307" data-hovercard-type="pull_request" data-hovercard-url="/matplotlib/matplotlib/pull/5307/hovercard" href="https://github.com/matplotlib/matplotlib/pull/5307">#5307</a>, where I am lowering our testing tolerance down to zero, I am discovering a few recent changes that slipped through because the tolerance on our tests was too high.</p>
<p dir="auto">This issue is the last of this type that I've found!</p>
<p dir="auto"><code class="notranslate">git bisect</code> points to <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/matplotlib/matplotlib/commit/ba7bc0a71001482e3719afd2ac1dc9ffe165f8d6/hovercard" href="https://github.com/matplotlib/matplotlib/commit/ba7bc0a71001482e3719afd2ac1dc9ffe165f8d6"><tt>ba7bc0a</tt></a> as being the first bad commit.</p>
<p dir="auto">BASELINE:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/38294/11341875/5071dfa4-91d2-11e5-84a7-5c946330349f.png"><img src="https://cloud.githubusercontent.com/assets/38294/11341875/5071dfa4-91d2-11e5-84a7-5c946330349f.png" alt="streamplot_colormap_test_image-expected" style="max-width: 100%;"></a></p>
<p dir="auto">ACTUAL OUTPUT:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/38294/11341880/56f76966-91d2-11e5-85b9-b4727a997595.png"><img src="https://cloud.githubusercontent.com/assets/38294/11341880/56f76966-91d2-11e5-85b9-b4727a997595.png" alt="streamplot_colormap_test_image" style="max-width: 100%;"></a></p>
<p dir="auto">TEST CODE:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@image_comparison(baseline_images=['streamplot_colormap_test_image'])
def test_colormap():
    X, Y, U, V = velocity_field()
    plt.streamplot(X, Y, U, V, color=U, density=0.6, linewidth=2,
                   cmap=plt.cm.autumn)
    plt.colorbar()"><pre class="notranslate"><code class="notranslate">@image_comparison(baseline_images=['streamplot_colormap_test_image'])
def test_colormap():
    X, Y, U, V = velocity_field()
    plt.streamplot(X, Y, U, V, color=U, density=0.6, linewidth=2,
                   cmap=plt.cm.autumn)
    plt.colorbar()
</code></pre></div>
<p dir="auto">Cc: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/efiring/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/efiring">@efiring</a>, Any thoughts?  Replacing the baseline with the new image is a reasonable solution, perhaps, in this case.</p>
<h3 dir="auto">Bug summary</h3>
<p dir="auto">When Roman text is included directly within dollar-delimited math mode text, Matplotlib emits an "Unknown symbol" error that indicates the problem is elsewhere.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt

# Doesn't work:
plt.plot([1, 2, 3], [1, 2, 3])
plt.gca().set_ylabel(r&quot;$\Delta x_1$&quot;)

# Works:
#plt.plot([1, 2, 3], [1, 2, 3])
#plt.gca().set_ylabel(r&quot;$\Delta \mathrm{x}_1$&quot;)

plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-c"># Doesn't work:</span>
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>], [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">gca</span>().<span class="pl-en">set_ylabel</span>(<span class="pl-s">r"$\Delta x_1$"</span>)

<span class="pl-c"># Works:</span>
<span class="pl-c">#plt.plot([1, 2, 3], [1, 2, 3])</span>
<span class="pl-c">#plt.gca().set_ylabel(r"$\Delta \mathrm{x}_1$")</span>

<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<h3 dir="auto">Actual outcome</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ValueError: 
\Delta x_1
^
Unknown symbol: \Delta, found '\'  (at char 0), (line:1, col:1)"><pre class="notranslate"><code class="notranslate">ValueError: 
\Delta x_1
^
Unknown symbol: \Delta, found '\'  (at char 0), (line:1, col:1)
</code></pre></div>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">I'd expect either:</p>
<ul dir="auto">
<li>the label to render correctly</li>
<li>or, if <code class="notranslate">$\Delta x_1$</code> is not supposed to be valid, then at least an error that indicates that the problem is the <code class="notranslate">x_1</code> after <code class="notranslate">\Delta</code> and not <code class="notranslate">\Delta</code> itself.</li>
</ul>
<p dir="auto">In both cases, it would be good if the documentation for math mode could be clarified regarding whether Roman text is allowed to be included inside <code class="notranslate">$...$</code> directly or not, and if not, suggest the use of <code class="notranslate">\mathrm</code>.</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Arch</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.4.3</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">TkAgg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.9.7</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Other libraries</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<h3 dir="auto">Conda channel</h3>
<p dir="auto"><em>No response</em></p>