Skip to content

Histograms disappear with logarithmic y-axis #9288

Closed
@alexpearce

Description

@alexpearce

Bug report

Bug summary

Setting a logarithmic y-axis with ax.set_yscale('log') causes histograms to disappear from the axis. This occurs in 2.1.0 but not in 2.0.2.

Code for reproduction

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')

Actual outcome

With 2.1.0:

2.1.0

Expected outcome

I expect to see a logarithm y-axis and the histogram, but I only see the former. With 2.0.2 I see this:

2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions