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

Skip to content

Commit 0100cec

Browse files
committed
Add test for using Axes.tick_params to set gridline properties
1 parent 538fb74 commit 0100cec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5152,6 +5152,18 @@ def test_axis_set_tick_params_labelsize_labelcolor():
51525152
assert axis_1.yaxis.majorTicks[0]._labelcolor == 'red'
51535153

51545154

5155+
def test_axes_tick_params_gridlines():
5156+
# Now treating grid params like other Tick params
5157+
ax = plt.subplot()
5158+
ax.tick_params(grid_color='b', grid_linewidth=5, grid_alpha=0.5,
5159+
grid_linestyle='dashdot')
5160+
for axis in ax.xaxis, ax.yaxis:
5161+
assert axis.majorTicks[0]._grid_color == 'b'
5162+
assert axis.majorTicks[0]._grid_linewidth == 5
5163+
assert axis.majorTicks[0]._grid_alpha == 0.5
5164+
assert axis.majorTicks[0]._grid_linestyle == 'dashdot'
5165+
5166+
51555167
def test_none_kwargs():
51565168
fig, ax = plt.subplots()
51575169
ln, = ax.plot(range(32), linestyle=None)

0 commit comments

Comments
 (0)