File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1208,8 +1208,11 @@ def get_yticks(self):
1208
1208
'Return the y ticks as a list of locations'
1209
1209
return self .yaxis .get_ticklocs ()
1210
1210
1211
- def grid (self , b ):
1212
- 'Set the axes grids on or off; b is a boolean'
1211
+ def grid (self , b = None ):
1212
+ """
1213
+ Set the axes grids on or off; b is a boolean
1214
+ if b is None, toggle the grid state
1215
+ """
1213
1216
self .xaxis .grid (b )
1214
1217
self .yaxis .grid (b )
1215
1218
Original file line number Diff line number Diff line change @@ -615,10 +615,12 @@ def get_minor_ticks(self):
615
615
616
616
return ticks
617
617
618
- def grid (self , b , which = 'major' ):
618
+ def grid (self , b = None , which = 'major' ):
619
619
"""
620
620
Set the axis grid on or off; b is a boolean use which =
621
621
'major' | 'minor' to set the grid for major or minor ticks
622
+
623
+ if b is None, toggle the grid state
622
624
"""
623
625
if which .lower ().find ('minor' )>= 0 :
624
626
if b is None : self ._gridOnMinor = not self ._gridOnMinor
You can’t perform that action at this time.
0 commit comments