Skip to content

CI: Fix matplolib release issues #48601

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

Merged
merged 9 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix
  • Loading branch information
phofl committed Sep 17, 2022
commit 7d6b5a06ff0dd0e19f66620f68ae50ae37b3e814
1 change: 0 additions & 1 deletion pandas/plotting/_matplotlib/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ def inner():
mpl_ge_3_4_0 = _mpl_version("3.4.0", operator.ge)
mpl_ge_3_5_0 = _mpl_version("3.5.0", operator.ge)
mpl_ge_3_6_0 = _mpl_version("3.6.0", operator.ge)
mpl_ge_3_6_0 = _mpl_version("3.6.0", operator.ge)
4 changes: 2 additions & 2 deletions pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ def _make_plot(self):
if is_integer_dtype(c_values):
# pandas uses colormap, matplotlib uses cmap.
cmap = self.colormap or "Greys"
if mpl_ge_3_6_0:
if mpl_ge_3_6_0():
cmap = mpl.colormaps[cmap]
else:
cmap = self.plt.cm.get_cmap(cmap)
Expand Down Expand Up @@ -1300,7 +1300,7 @@ def _make_plot(self) -> None:
ax = self.axes[0]
# pandas uses colormap, matplotlib uses cmap.
cmap = self.colormap or "BuGn"
if mpl_ge_3_6_0:
if mpl_ge_3_6_0():
cmap = mpl.colormaps[cmap]
else:
cmap = self.plt.cm.get_cmap(cmap)
Expand Down
2 changes: 1 addition & 1 deletion pandas/plotting/_matplotlib/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _get_cmap_instance(colormap: str | Colormap) -> Colormap:
"""Get instance of matplotlib colormap."""
if isinstance(colormap, str):
cmap = colormap
if mpl_ge_3_6_0:
if mpl_ge_3_6_0():
colormap = mpl.colormaps[colormap]
else:
colormap = cm.get_cmap(colormap)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/frame/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
try:
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0
except ImportError:
mpl_ge_3_6_0 = True
mpl_ge_3_6_0 = lambda: True


@td.skip_if_no_mpl
class TestDataFramePlots(TestPlotBase):
@pytest.mark.xfail(mpl_ge_3_6_0, reason="Api changed")
@pytest.mark.xfail(mpl_ge_3_6_0(), reason="Api changed")
@pytest.mark.slow
def test_plot(self):
df = tm.makeTimeDataFrame()
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
try:
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0
except ImportError:
mpl_ge_3_6_0 = True
mpl_ge_3_6_0 = lambda: True

from pandas.tseries.offsets import WeekOfMonth

Expand Down Expand Up @@ -265,7 +265,7 @@ def test_plot_multiple_inferred_freq(self):
ser = Series(np.random.randn(len(dr)), index=dr)
_check_plot_works(ser.plot)

@pytest.mark.xfail(mpl_ge_3_6_0, reason="Api changed")
@pytest.mark.xfail(mpl_ge_3_6_0(), reason="Api changed")
def test_uhf(self):
import pandas.plotting._matplotlib.converter as conv

Expand Down Expand Up @@ -1215,7 +1215,7 @@ def test_secondary_legend(self):
# TODO: color cycle problems
assert len(colors) == 4

@pytest.mark.xfail(mpl_ge_3_6_0, reason="Api changed")
@pytest.mark.xfail(mpl_ge_3_6_0(), reason="Api changed")
def test_format_date_axis(self):
rng = date_range("1/1/2012", periods=12, freq="M")
df = DataFrame(np.random.randn(len(rng), 3), rng)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_hist_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
try:
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0
except ImportError:
mpl_ge_3_6_0 = True
mpl_ge_3_6_0 = lambda: True


@pytest.fixture
Expand Down Expand Up @@ -196,7 +196,7 @@ def test_hist_kwargs(self, ts):
ax = ts.plot.hist(align="left", stacked=True, ax=ax)
tm.close()

@pytest.mark.xfail(mpl_ge_3_6_0, reason="Api changed")
@pytest.mark.xfail(mpl_ge_3_6_0(), reason="Api changed")
@td.skip_if_no_scipy
def test_hist_kde(self, ts):

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
try:
from pandas.plotting._matplotlib.compat import mpl_ge_3_6_0
except ImportError:
mpl_ge_3_6_0 = True
mpl_ge_3_6_0 = lambda: True


@pytest.fixture
Expand Down Expand Up @@ -498,7 +498,7 @@ def test_kde_missing_vals(self):
# gh-14821: check if the values have any missing values
assert any(~np.isnan(axes.lines[0].get_xdata()))

@pytest.mark.xfail(mpl_ge_3_6_0, reason="Api changed")
@pytest.mark.xfail(mpl_ge_3_6_0(), reason="Api changed")
def test_boxplot_series(self, ts):
_, ax = self.plt.subplots()
ax = ts.plot.box(logy=True, ax=ax)
Expand Down