Skip to content

Commit

Permalink
Update Axes.grid keyword to use 'visible' (#383)
Browse files Browse the repository at this point in the history
This PR updates the Axes.grid keyword arguments to use visible that is needed because of upstream matplotlib updates.

This PR replaces #368

Co-authored-by: Evan Goetz <[email protected]>
  • Loading branch information
eagoetz and Evan Goetz authored Nov 1, 2023
1 parent b5559a4 commit a50504f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions gwsumm/plot/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def init_plot(self, *args, **kwargs):
ax.set_epoch(float(epoch if epoch is not None else self.start))
if ax.get_autoscalex_on():
ax.set_xlim(float(self.start), float(self.end))
ax.grid(True, which='both')
ax.grid(visible=True, which='both')
return plot

# -- main draw method -----------------------
Expand Down Expand Up @@ -319,7 +319,7 @@ def draw(self):
# initialise
plot = self.init_plot()
ax = plot.gca()
ax.grid(b=True, axis='y', which='major')
ax.grid(visible=True, axis='y', which='major')
channel = self.channels[0]

# parse data arguments
Expand Down Expand Up @@ -463,7 +463,7 @@ def _draw(self):
"""
plot = self.init_plot()
ax = plot.gca()
ax.grid(b=True, axis='both', which='both')
ax.grid(visible=True, axis='both', which='both')

if self.state:
self.pargs.setdefault(
Expand Down Expand Up @@ -661,7 +661,7 @@ def init_plot(self, geometry=None, **kwargs):
plot = super(TimeSeriesHistogramPlot, self).init_plot(
geometry=geometry, **kwargs)
for ax in plot.axes:
ax.grid(True, which='both')
ax.grid(visible=True, which='both')
return plot

def parse_plot_kwargs(self, **defaults):
Expand Down Expand Up @@ -982,7 +982,7 @@ def _draw(self):
# customise
self.add_hvlines()
self.apply_parameters(ax, **self.pargs)
ax.grid(b=True, axis='both', which='both')
ax.grid(visible=True, axis='both', which='both')

return self.finalize()

Expand Down
2 changes: 1 addition & 1 deletion gwsumm/plot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def apply_parameters(self, *axes, **pargs):

def _apply_grid_params(self, ax, val):
if val in ('major', 'minor'):
ax.grid(True, which=val)
ax.grid(visible=True, which=val)
else:
ax.grid(val)

Expand Down
4 changes: 2 additions & 2 deletions gwsumm/plot/noisebudget.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _draw(self):
"""
plot = self.init_plot()
ax = plot.gca()
ax.grid(b=True, axis='both', which='both')
ax.grid(visible=True, axis='both', which='both')

if self.state:
self.pargs.setdefault(
Expand Down Expand Up @@ -175,7 +175,7 @@ def _draw(self):
"""
plot = self.init_plot()
ax = plot.gca()
ax.grid(b=True, axis='both', which='both')
ax.grid(visible=True, axis='both', which='both')

if self.state:
self.pargs.setdefault(
Expand Down
4 changes: 2 additions & 2 deletions gwsumm/plot/segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def draw(self):
# make figure
plot = self.init_plot()
ax = plot.gca()
ax.grid(False, which='both', axis='y')
ax.grid(visible=False, which='both', axis='y')

# extract plotting arguments
nosummary = self.pargs.pop('no_summary_bit', False)
Expand Down Expand Up @@ -1272,7 +1272,7 @@ def draw(self, outputfile=None):
rotation_mode='anchor', ha='right', fontsize=13)
ax.tick_params(axis='x', pad=2)
ax.xaxis.labelpad = 2
ax.xaxis.grid(False)
ax.xaxis.grid(visible=False)
self.pargs.setdefault('xlim', (-.5, len(data)-.5))

# customise plot
Expand Down
2 changes: 1 addition & 1 deletion gwsumm/plot/triggers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def draw(self):
# initialise figure
plot = self.init_plot()
ax = plot.gca()
ax.grid(True, which='both')
ax.grid(visible=True, which='both')

# work out labels
labels = self.pargs.pop('labels', self.channels)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies = [
"lxml",
"markdown",
"MarkupPy",
"matplotlib >=3.1",
"matplotlib >=3.5",
"numpy >=1.16",
"pygments >=2.7.0",
"python-dateutil",
Expand Down

0 comments on commit a50504f

Please sign in to comment.