From 438ac69cdbd60818f703c6866b6f539bf00c6a4a Mon Sep 17 00:00:00 2001 From: Boris Rumyantsev Date: Tue, 19 Oct 2021 23:00:00 +0300 Subject: [PATCH] TST: Adding test to test_style (#3188) --- pandas/tests/plotting/test_style.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pandas/tests/plotting/test_style.py b/pandas/tests/plotting/test_style.py index 3c48eeaccbf34..fbc4c2efa4b92 100644 --- a/pandas/tests/plotting/test_style.py +++ b/pandas/tests/plotting/test_style.py @@ -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 @@ -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