<p dir="auto">master but also present on 1.5.3</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="imshow(rand(5, 5)); gca().set_xticklabels([&quot;foo&quot;, &quot;bar&quot;])"><pre class="notranslate"><code class="notranslate">imshow(rand(5, 5)); gca().set_xticklabels(["foo", "bar"])
</code></pre></div>
<p dir="auto">results in<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1322974/27292549-a77001c2-54c8-11e7-9f26-ad6d9fa02798.png"><img src="https://user-images.githubusercontent.com/1322974/27292549-a77001c2-54c8-11e7-9f26-ad6d9fa02798.png" alt="figure_1" style="max-width: 100%;"></a><br>
Almost certain this is due to the xticks internally including a tick at the position "just left of bounds".  Seems related (not directly, though) to the issue discussed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="175120299" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/7042" data-hovercard-type="pull_request" data-hovercard-url="/matplotlib/matplotlib/pull/7042/hovercard" href="https://github.com/matplotlib/matplotlib/pull/7042">#7042</a>.</p>
<p dir="auto">Tested on matplotib 1.5.1 on OSX, pip installation. Not sure about regression but I never noticed this behavior before.</p>
<p dir="auto"><strong>Expected behavior</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.set_xlim(0, 2)
plt.show()"><pre class="notranslate"><code class="notranslate">plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.set_xlim(0, 2)
plt.show()
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/327203/18595348/926c9c3e-7c44-11e6-9d31-05ade1669666.png"><img src="https://cloud.githubusercontent.com/assets/327203/18595348/926c9c3e-7c44-11e6-9d31-05ade1669666.png" alt="output-1" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Bad</strong>: Extends the x limit for unknown reason</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="majors = [&quot;0&quot;, &quot;1&quot;, &quot;2&quot;]
plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.set_xlim(0, 2)
plt.show()"><pre class="notranslate"><code class="notranslate">majors = ["0", "1", "2"]
plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.set_xlim(0, 2)
plt.show()
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/327203/18595352/9927de4e-7c44-11e6-8af5-00b0eca10522.png"><img src="https://cloud.githubusercontent.com/assets/327203/18595352/9927de4e-7c44-11e6-8af5-00b0eca10522.png" alt="output-2" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Bad</strong>: First item is not displayed</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="majors = [&quot;0&quot;, &quot;1&quot;, &quot;2&quot;]
plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.set_xlim(0, 2)
plt.show()"><pre class="notranslate"><code class="notranslate">majors = ["0", "1", "2"]
plt.figure(figsize=(6, 4))
ax = plt.subplot(1, 1, 1)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.set_xlim(0, 2)
plt.show()
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/327203/18595357/a038563c-7c44-11e6-818a-05673bffb7ee.png"><img src="https://cloud.githubusercontent.com/assets/327203/18595357/a038563c-7c44-11e6-818a-05673bffb7ee.png" alt="output-3" style="max-width: 100%;"></a></p>