Skip to content
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

Trying to set_ylim(bottom=0) on a log scaled axis changes plot #7733

Closed
dstansby opened this issue Jan 3, 2017 · 1 comment
Closed

Trying to set_ylim(bottom=0) on a log scaled axis changes plot #7733

dstansby opened this issue Jan 3, 2017 · 1 comment
Milestone

Comments

@dstansby
Copy link
Member

dstansby commented Jan 3, 2017

import matplotlib.pyplot as plt

fig, axs = plt.subplots(2, 1)

axs[0].scatter(range(0, 4), [0, 1, 2, 3])
axs[1].scatter(range(0, 4), [0, 1, 2, 3])

axs[0].set_yscale('log')
axs[1].set_yscale('log')

axs[1].set_ylim(bottom=0)

plt.show()

This raises

/home/dstansby/matplotlib/lib/matplotlib/axes/_base.py:3174: UserWarning: Attempted to set non-positive ylimits for log-scale axis; invalid limits will be ignored.
  'Attempted to set non-positive ylimits for log-scale axis; '

However, the 2nd plot is changed by the set_ylim(bottom=0) call, and no data is visible.

figure_1

This is present on master.

@anntzer
Copy link
Contributor

anntzer commented Jan 13, 2017

See also the discussion at #7460 and the related PR #7744. It would be nice to have a consistent behavior in both cases (and possibly reuse the same code-path, if possible). As argued in #7460, I personally prefer the behavior of #7735 (treat invalid values as nan).

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jan 13, 2017
@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.1.1 (next bug fix release) Sep 24, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@dstansby dstansby modified the milestones: needs sorting, v3.0 Apr 4, 2018
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

No branches or pull requests

3 participants