Skip to content

Commit 2dad39e

Browse files
committed
TST: Adding test to test_style (pandas-dev#3188)
1 parent ef9416c commit 2dad39e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/plotting/test_style.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import matplotlib
12
import pytest
23

34
from pandas import Series
@@ -157,3 +158,17 @@ def test_empty_color_raises(self, color):
157158
def test_bad_color_raises(self, color):
158159
with pytest.raises(ValueError, match="Invalid color"):
159160
get_standard_colors(color=color, num_colors=5)
161+
162+
@pytest.mark.parametrize("grid", (None, True, False))
163+
def test_plot_mplback_by_default_use_axes_grid_from_rcparams(grid):
164+
# GH 3188
165+
ax = Series([1, 2, 3, 4, 5]).plot(grid=grid)
166+
if grid is None:
167+
assert matplotlib.rcParams["axes.grid"] == ax._gridOn
168+
else:
169+
assert grid == all(
170+
[
171+
ax.get_yaxis()._major_tick_kw["gridOn"],
172+
ax.get_xaxis()._major_tick_kw["gridOn"],
173+
]
174+
)

0 commit comments

Comments
 (0)