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

Skip to content

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

Closed
@QuLogic

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.

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