Skip to content

Commit

Permalink
Update Axes.grid keyword to use 'visible'
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
  • Loading branch information
Evan Goetz committed Nov 1, 2023
1 parent b5559a4 commit f5d3cde
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')

Check warning on line 322 in gwsumm/plot/builtin.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/builtin.py#L322

Added line #L322 was not covered by tests
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')

Check warning on line 466 in gwsumm/plot/builtin.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/builtin.py#L466

Added line #L466 was not covered by tests

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')

Check warning on line 664 in gwsumm/plot/builtin.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/builtin.py#L664

Added line #L664 was not covered by tests
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')

Check warning on line 985 in gwsumm/plot/builtin.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/builtin.py#L985

Added line #L985 was not covered by tests

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)

Check warning on line 794 in gwsumm/plot/core.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/core.py#L794

Added line #L794 was not covered by tests
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')

Check warning on line 76 in gwsumm/plot/noisebudget.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/noisebudget.py#L76

Added line #L76 was not covered by tests

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')

Check warning on line 178 in gwsumm/plot/noisebudget.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/noisebudget.py#L178

Added line #L178 was not covered by tests

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')

Check warning on line 850 in gwsumm/plot/segments.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/segments.py#L850

Added line #L850 was not covered by tests

# 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)

Check warning on line 1275 in gwsumm/plot/segments.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/segments.py#L1275

Added line #L1275 was not covered by tests
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')

Check warning on line 147 in gwsumm/plot/triggers/core.py

View check run for this annotation

Codecov / codecov/patch

gwsumm/plot/triggers/core.py#L147

Added line #L147 was not covered by tests

# 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 f5d3cde

Please sign in to comment.