Skip to content

TST: Adding test for checking that plotting grid param by default is mpl.rcParams['axes.grid'] #44114

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
wants to merge 1 commit into from
Closed
Changes from all commits
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
16 changes: 15 additions & 1 deletion pandas/tests/plotting/test_style.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import pytest

from pandas import Series
from pandas import (
DataFrame,
Series,
)

pytest.importorskip("matplotlib")
from pandas.plotting._matplotlib.style import get_standard_colors
Expand Down Expand Up @@ -157,3 +160,14 @@ def test_empty_color_raises(self, color):
def test_bad_color_raises(self, color):
with pytest.raises(ValueError, match="Invalid color"):
get_standard_colors(color=color, num_colors=5)


class TestDefaultMplStyleParams:
@pytest.mark.parametrize("rcGrid", [True, False])
def test_mplback_df_plot_by_default_use_axes_grid_from_rcparams(self, rcGrid):
import matplotlib as mpl

# GH 3188
mpl.rcParams["axes.grid"] = rcGrid
ax = DataFrame([1, 2, 3, 4, 5]).plot()
assert mpl.rcParams["axes.grid"] == ax._gridOn