Skip to content

setting yscale to log, after drawing a plot with values equal to zero, results in incorrect handling of zero values #8045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anntzer opened this issue Feb 8, 2017 · 2 comments
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Feb 8, 2017

mpl 1.5.3 and 2.0, py3.6

_xs = np.linspace(-50, 50, 1001); plt.semilogy(scipy.stats.norm.pdf(_xs))

results in
figure_1
where zero values (due to floating point resolution limits, at the edges) get ignored, as expected, but

_xs = np.linspace(-50, 50, 1001); plt.plot(scipy.stats.norm.pdf(_xs))
plt.gcf().canvas.draw()
plt.gca().set(yscale="log")

results in the incorrect
figure_2

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Feb 8, 2017
@jcalbert
Copy link
Contributor

jcalbert commented Feb 10, 2017

I think this boils down to lines 3241-3242 in axes/_base.py:

if value.lower() == 'log' and 'nonposy' not in kwargs:
    kwargs['nonposy'] = 'mask'

and is fixed by changing 'mask' to 'clip'.

Working on it now.

@dstansby
Copy link
Member

Fixed by #8836

@QuLogic QuLogic modified the milestones: 2.1 (next point release), 2.0.3 (next bug fix release) Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants