<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Histogram missing in Matplotlib 2.1.0. See the following figures, one is from 2.1.0 and the other is from 2.0.2.</p>

<p dir="auto"><strong>Code for reproduction</strong></p>

<p dir="auto">This code is exactly the same code we are using except the data is changed to random one. I suppose it will be minimal enough?</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#!/usr/bin/env python3

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import collections

def plot_figure(distribution):
    percentile = [95, 99]
    percentile_color = 'yg'
    mean_color = 'c'
    bins = 100

    legend_handle = []
    legend_title = []

    fig, (ax0, ax1) = plt.subplots(2, sharex=True)
    fig.subplots_adjust(hspace=0)
    mu, sigma = 100, 15
    xs_downstream = mu + sigma*np.random.randn(10000)
    xs_upstream = mu + sigma*np.random.randn(10000)
    xmin = min(np.min(xs_downstream), np.min(xs_upstream))
    xmax = max(np.max(xs_downstream), np.max(xs_upstream))

    hist0 = ax0.hist(xs_downstream, bins=bins, range=(xmin, xmax), color='red', label='{} workload with Proxy'.format(distribution.capitalize()))
    handles, labels = ax0.get_legend_handles_labels()
    line = ax0.axvline(x=np.mean(xs_downstream), color=mean_color, linewidth=1)
    legend_title.append('Mean')
    legend_handle.append(line)

    for percent, color in zip(percentile, percentile_color):
        line = ax0.axvline(x=xs_downstream[int(percent / 100 * len(xs_downstream))], color=color, linewidth=1)
        legend_title.append('{}th percentile'.format(percent))
        legend_handle.append(line)

    ax0.set_yscale('log')
    legend_title += labels
    legend_handle += handles

    hist1 = ax1.hist(xs_upstream, bins=bins, range=(xmin, xmax), color='blue', label='{} workload without Proxy'.format(distribution.capitalize()))
    handles, labels = ax1.get_legend_handles_labels()
    legend_title += labels
    legend_handle += handles
    ax1.axvline(x=np.mean(xs_upstream), color=mean_color, linewidth=1)

    for percent, color in zip(percentile, percentile_color):
        ax1.axvline(x=xs_upstream[int(percent / 100 * len(xs_upstream))], color=color, linewidth=1)

    ax1.set_yscale('log')
    ax0.legend(legend_handle, legend_title)
    ax1.set_xlabel('latency (ms)')

    fig.savefig('latency-{}.pdf'.format(distribution))

def main():
    plot_figure('zipf')
    plot_figure('uniform')

if __name__ == '__main__':
    main()
"><pre class="notranslate"><span class="pl-c">#!/usr/bin/env python3</span>

<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<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-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">ticker</span> <span class="pl-k">as</span> <span class="pl-s1">ticker</span>
<span class="pl-k">import</span> <span class="pl-s1">collections</span>

<span class="pl-k">def</span> <span class="pl-en">plot_figure</span>(<span class="pl-s1">distribution</span>):
    <span class="pl-s1">percentile</span> <span class="pl-c1">=</span> [<span class="pl-c1">95</span>, <span class="pl-c1">99</span>]
    <span class="pl-s1">percentile_color</span> <span class="pl-c1">=</span> <span class="pl-s">'yg'</span>
    <span class="pl-s1">mean_color</span> <span class="pl-c1">=</span> <span class="pl-s">'c'</span>
    <span class="pl-s1">bins</span> <span class="pl-c1">=</span> <span class="pl-c1">100</span>

    <span class="pl-s1">legend_handle</span> <span class="pl-c1">=</span> []
    <span class="pl-s1">legend_title</span> <span class="pl-c1">=</span> []

    <span class="pl-s1">fig</span>, (<span class="pl-s1">ax0</span>, <span class="pl-s1">ax1</span>) <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-c1">2</span>, <span class="pl-s1">sharex</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">fig</span>.<span class="pl-en">subplots_adjust</span>(<span class="pl-s1">hspace</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)
    <span class="pl-s1">mu</span>, <span class="pl-s1">sigma</span> <span class="pl-c1">=</span> <span class="pl-c1">100</span>, <span class="pl-c1">15</span>
    <span class="pl-s1">xs_downstream</span> <span class="pl-c1">=</span> <span class="pl-s1">mu</span> <span class="pl-c1">+</span> <span class="pl-s1">sigma</span><span class="pl-c1">*</span><span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">10000</span>)
    <span class="pl-s1">xs_upstream</span> <span class="pl-c1">=</span> <span class="pl-s1">mu</span> <span class="pl-c1">+</span> <span class="pl-s1">sigma</span><span class="pl-c1">*</span><span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">10000</span>)
    <span class="pl-s1">xmin</span> <span class="pl-c1">=</span> <span class="pl-en">min</span>(<span class="pl-s1">np</span>.<span class="pl-en">min</span>(<span class="pl-s1">xs_downstream</span>), <span class="pl-s1">np</span>.<span class="pl-en">min</span>(<span class="pl-s1">xs_upstream</span>))
    <span class="pl-s1">xmax</span> <span class="pl-c1">=</span> <span class="pl-en">max</span>(<span class="pl-s1">np</span>.<span class="pl-en">max</span>(<span class="pl-s1">xs_downstream</span>), <span class="pl-s1">np</span>.<span class="pl-en">max</span>(<span class="pl-s1">xs_upstream</span>))

    <span class="pl-s1">hist0</span> <span class="pl-c1">=</span> <span class="pl-s1">ax0</span>.<span class="pl-en">hist</span>(<span class="pl-s1">xs_downstream</span>, <span class="pl-s1">bins</span><span class="pl-c1">=</span><span class="pl-s1">bins</span>, <span class="pl-s1">range</span><span class="pl-c1">=</span>(<span class="pl-s1">xmin</span>, <span class="pl-s1">xmax</span>), <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s">'red'</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">'{} workload with Proxy'</span>.<span class="pl-en">format</span>(<span class="pl-s1">distribution</span>.<span class="pl-en">capitalize</span>()))
    <span class="pl-s1">handles</span>, <span class="pl-s1">labels</span> <span class="pl-c1">=</span> <span class="pl-s1">ax0</span>.<span class="pl-en">get_legend_handles_labels</span>()
    <span class="pl-s1">line</span> <span class="pl-c1">=</span> <span class="pl-s1">ax0</span>.<span class="pl-en">axvline</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-en">mean</span>(<span class="pl-s1">xs_downstream</span>), <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s1">mean_color</span>, <span class="pl-s1">linewidth</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
    <span class="pl-s1">legend_title</span>.<span class="pl-en">append</span>(<span class="pl-s">'Mean'</span>)
    <span class="pl-s1">legend_handle</span>.<span class="pl-en">append</span>(<span class="pl-s1">line</span>)

    <span class="pl-k">for</span> <span class="pl-s1">percent</span>, <span class="pl-s1">color</span> <span class="pl-c1">in</span> <span class="pl-en">zip</span>(<span class="pl-s1">percentile</span>, <span class="pl-s1">percentile_color</span>):
        <span class="pl-s1">line</span> <span class="pl-c1">=</span> <span class="pl-s1">ax0</span>.<span class="pl-en">axvline</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">xs_downstream</span>[<span class="pl-en">int</span>(<span class="pl-s1">percent</span> <span class="pl-c1">/</span> <span class="pl-c1">100</span> <span class="pl-c1">*</span> <span class="pl-en">len</span>(<span class="pl-s1">xs_downstream</span>))], <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s1">color</span>, <span class="pl-s1">linewidth</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
        <span class="pl-s1">legend_title</span>.<span class="pl-en">append</span>(<span class="pl-s">'{}th percentile'</span>.<span class="pl-en">format</span>(<span class="pl-s1">percent</span>))
        <span class="pl-s1">legend_handle</span>.<span class="pl-en">append</span>(<span class="pl-s1">line</span>)

    <span class="pl-s1">ax0</span>.<span class="pl-en">set_yscale</span>(<span class="pl-s">'log'</span>)
    <span class="pl-s1">legend_title</span> <span class="pl-c1">+=</span> <span class="pl-s1">labels</span>
    <span class="pl-s1">legend_handle</span> <span class="pl-c1">+=</span> <span class="pl-s1">handles</span>

    <span class="pl-s1">hist1</span> <span class="pl-c1">=</span> <span class="pl-s1">ax1</span>.<span class="pl-en">hist</span>(<span class="pl-s1">xs_upstream</span>, <span class="pl-s1">bins</span><span class="pl-c1">=</span><span class="pl-s1">bins</span>, <span class="pl-s1">range</span><span class="pl-c1">=</span>(<span class="pl-s1">xmin</span>, <span class="pl-s1">xmax</span>), <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s">'blue'</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">'{} workload without Proxy'</span>.<span class="pl-en">format</span>(<span class="pl-s1">distribution</span>.<span class="pl-en">capitalize</span>()))
    <span class="pl-s1">handles</span>, <span class="pl-s1">labels</span> <span class="pl-c1">=</span> <span class="pl-s1">ax1</span>.<span class="pl-en">get_legend_handles_labels</span>()
    <span class="pl-s1">legend_title</span> <span class="pl-c1">+=</span> <span class="pl-s1">labels</span>
    <span class="pl-s1">legend_handle</span> <span class="pl-c1">+=</span> <span class="pl-s1">handles</span>
    <span class="pl-s1">ax1</span>.<span class="pl-en">axvline</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-en">mean</span>(<span class="pl-s1">xs_upstream</span>), <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s1">mean_color</span>, <span class="pl-s1">linewidth</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)

    <span class="pl-k">for</span> <span class="pl-s1">percent</span>, <span class="pl-s1">color</span> <span class="pl-c1">in</span> <span class="pl-en">zip</span>(<span class="pl-s1">percentile</span>, <span class="pl-s1">percentile_color</span>):
        <span class="pl-s1">ax1</span>.<span class="pl-en">axvline</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s1">xs_upstream</span>[<span class="pl-en">int</span>(<span class="pl-s1">percent</span> <span class="pl-c1">/</span> <span class="pl-c1">100</span> <span class="pl-c1">*</span> <span class="pl-en">len</span>(<span class="pl-s1">xs_upstream</span>))], <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s1">color</span>, <span class="pl-s1">linewidth</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)

    <span class="pl-s1">ax1</span>.<span class="pl-en">set_yscale</span>(<span class="pl-s">'log'</span>)
    <span class="pl-s1">ax0</span>.<span class="pl-en">legend</span>(<span class="pl-s1">legend_handle</span>, <span class="pl-s1">legend_title</span>)
    <span class="pl-s1">ax1</span>.<span class="pl-en">set_xlabel</span>(<span class="pl-s">'latency (ms)'</span>)

    <span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'latency-{}.pdf'</span>.<span class="pl-en">format</span>(<span class="pl-s1">distribution</span>))

<span class="pl-k">def</span> <span class="pl-en">main</span>():
    <span class="pl-en">plot_figure</span>(<span class="pl-s">'zipf'</span>)
    <span class="pl-en">plot_figure</span>(<span class="pl-s">'uniform'</span>)

<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">'__main__'</span>:
    <span class="pl-en">main</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2470081/32174680-e8f9d1ba-bd58-11e7-86a7-b6b13041aea9.png"><img width="890" alt="qq20171030-095657 2x" src="https://user-images.githubusercontent.com/2470081/32174680-e8f9d1ba-bd58-11e7-86a7-b6b13041aea9.png" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>


<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2470081/32174688-ebe0f0b6-bd58-11e7-9835-24679b787c75.png"><img width="890" alt="qq20171030-095722 2x" src="https://user-images.githubusercontent.com/2470081/32174688-ebe0f0b6-bd58-11e7-9835-24679b787c75.png" style="max-width: 100%;"></a></p>
<p dir="auto">Works well in 2.0.2.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Both macOS High Sierra and Ubuntu 17.10</li>
<li>Matplotlib version: 2.1.0</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): <code class="notranslate">MacOSX</code></li>
<li>Python version: <code class="notranslate">3.6.3</code></li>
<li>Jupyter version (if applicable):</li>
<li>Other libraries:</li>
</ul>
<p dir="auto">Installed using <code class="notranslate">pip3</code></p>


<p dir="auto">Thanks!</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Setting a logarithmic y-axis with <code class="notranslate">ax.set_yscale('log')</code> causes histograms to disappear from the axis. This occurs in <a href="https://github.com/matplotlib/matplotlib/releases/tag/v2.1.0">2.1.0</a> but not in 2.0.2.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np

xs = np.random.normal(size=int(1e6))
fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.hist(xs, range=(-5, 5), bins=100)
ax2.hist(xs, range=(-5, 5), bins=100)
ax2.set_ylim(ymin=1)
ax2.set_yscale('log')
fig.savefig('histogram.png')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-s1">matplotlib</span>.<span class="pl-en">use</span>(<span class="pl-s">'Agg'</span>)
<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-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">xs</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">normal</span>(<span class="pl-s1">size</span><span class="pl-c1">=</span><span class="pl-en">int</span>(<span class="pl-c1">1e6</span>))
<span class="pl-s1">fig</span>, (<span class="pl-s1">ax1</span>, <span class="pl-s1">ax2</span>) <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-c1">1</span>, <span class="pl-c1">2</span>)
<span class="pl-s1">ax1</span>.<span class="pl-en">hist</span>(<span class="pl-s1">xs</span>, <span class="pl-s1">range</span><span class="pl-c1">=</span>(<span class="pl-c1">-</span><span class="pl-c1">5</span>, <span class="pl-c1">5</span>), <span class="pl-s1">bins</span><span class="pl-c1">=</span><span class="pl-c1">100</span>)
<span class="pl-s1">ax2</span>.<span class="pl-en">hist</span>(<span class="pl-s1">xs</span>, <span class="pl-s1">range</span><span class="pl-c1">=</span>(<span class="pl-c1">-</span><span class="pl-c1">5</span>, <span class="pl-c1">5</span>), <span class="pl-s1">bins</span><span class="pl-c1">=</span><span class="pl-c1">100</span>)
<span class="pl-s1">ax2</span>.<span class="pl-en">set_ylim</span>(<span class="pl-s1">ymin</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
<span class="pl-s1">ax2</span>.<span class="pl-en">set_yscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'histogram.png'</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto">With <strong>2.1.0</strong>:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/540853/31249955-9632ab66-aa19-11e7-8aab-c6a7ccac306f.png"><img src="https://user-images.githubusercontent.com/540853/31249955-9632ab66-aa19-11e7-8aab-c6a7ccac306f.png" alt="2.1.0" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">I expect to see a logarithm y-axis <em>and</em> the histogram, but I only see the former. With <strong>2.0.2</strong> I see this:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/540853/31249924-795ab998-aa19-11e7-8c3f-f205ea54e817.png"><img src="https://user-images.githubusercontent.com/540853/31249924-795ab998-aa19-11e7-8c3f-f205ea54e817.png" alt="2.0.2" style="max-width: 100%;"></a></p>