Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Inverting an axis using its limits does not work for log scale #14615

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
lkluft opened this issue Jun 25, 2019 · 2 comments
Closed

Inverting an axis using its limits does not work for log scale #14615

lkluft opened this issue Jun 25, 2019 · 2 comments
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone

Comments

@lkluft
Copy link

lkluft commented Jun 25, 2019

Bug report

Bug summary
Starting in matplotlib 3.1.0 it is no longer possible to invert a log axis using its limits.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt


y = np.linspace(1000e2, 1, 100)
x = np.exp(-np.linspace(0, 1, y.size))

for yscale in ('linear', 'log'):
    fig, ax = plt.subplots()
    ax.plot(x, y)
    ax.set_yscale(yscale)
    ax.set_ylim(y.max(), y.min())

Actual outcome
The yaxis is only inverted for the "linear" scale.

linear

log

Expected outcome
I would expect the yaxis to be inverted for both the "linear" and the "log" scale.

Matplotlib version

  • Operating system: Linux and MacOS
  • Matplotlib version: 3.1.0
  • Python version: 3.7.3

Python and matplotlib have been installed using conda.

@anntzer anntzer added this to the v3.1.1 milestone Jun 25, 2019
@anntzer anntzer added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Jun 25, 2019
@anntzer
Copy link
Contributor

anntzer commented Jun 25, 2019

Good catch. This was broken in #13409; on master this is fixed by #13593, which is too big to backport, but I can just extract 160de56#diff-cdfe9e4fdad4085b0a74c1dbe0def08dR16 which is enough.

@ivanov
Copy link
Member

ivanov commented Jun 30, 2019

Thanks for the excellent bug report, @lkluft ! For matplotlib 3.1.1, @anntzer provided the fix in the combination of #14623 and #14643.

@ivanov ivanov closed this as completed Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

No branches or pull requests

3 participants