Skip to content

BUG: shared log axes lose _minpos and revert to default #7587

Closed

Description

@QuLogic

This example showcases two instances where the view limits in 1.5.3 are not the same as when using 2.0.0rc1 with the classic style.

from distutils.version import LooseVersion

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt


if LooseVersion(mpl.__version__) >= LooseVersion('2.0.0'):
    plt.style.use('classic')


cc_t = np.arange(-100, 101, 5) / 1000
cc_concave = np.ones_like(cc_t)

fig, ax = plt.subplots()
ax.plot(cc_t, cc_concave, ls="", marker=".", color="0.7",
        label="xcorr (concave)")
ax.set_title(mpl.__version__)


np.random.seed(0)
freq = np.arange(0.0, 100.0, 0.001)
resp = np.random.rand(*freq.shape) + 1j * np.random.rand(*freq.shape)

fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
ax1.loglog(freq, abs(resp), lw=1.5)
ax1.set_title(mpl.__version__)
ax2.semilogx(freq, np.angle(resp), lw=1.5)
ax2.set_title(mpl.__version__)

plt.show()

For the first plot, with 1.5.3, the resulting image, with view limits (-0.1, 0.15), is:

figure_1

but with 2.0.0rc1 in classic style, its view limits are (-0.1, 0.1):
figure_1-2 0 0rc1

For the second plot, with 1.5.3, the result image, with view limits (10^-3, 10^2), is:
figure_2

but with 2.0.0rc1 in classic style, its view limits are (10^-7, 10^2):
figure_2-2 0 0rc1

The interesting thing is that this view limit is only triggered if something is plotted in both axes.

Activity

  1. added this to the milestone on Dec 8, 2016
  2. efiring commented on Dec 8, 2016

    @efiring
    Member

    The first example is the sort of thing we have to expect; classic style brings things close to 1.5.3, but trying to guarantee identical results is the road to insanity. There is nothing wrong with the 2.0 classic version.
    The second example is pointing to a major bug in how the invalid zero frequency value is handled with shared axes. The problem is that somehow, having the second log axes is causing the default Bbox._minpos value of 1e-7 to override the actual minimum positive value.

  3. efiring commented on Dec 8, 2016

    @efiring
    Member

    That second example looks familiar... It seems like we have dealt with this, or at least had it pointed out, some time ago. Or maybe I saw it in devdocs but passed over it without investigating.
    The bug is not specific to classic style; it also occurs with the 2.0 default style.

  4. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Dec 8, 2016
  5. changed the title [-]Change of view limits in 2.0.0rc1 classic style vs 1.5.3[/-] [+]BUG: shared log axes lose _minpos and revert to default[/+] on Dec 8, 2016
  6. QuLogic commented on Dec 8, 2016

    @QuLogic
    MemberAuthor

    Maybe you were thinking of #7410? It seems to be a similar topic.

  7. efiring commented on Dec 8, 2016

    @efiring
    Member

    This is related to #7493.

  8. self-assigned this
    on Dec 8, 2016
  9. QuLogic commented on Dec 13, 2016

    @QuLogic
    MemberAuthor

    Closed by #7598.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions