From a50504f7a14e58cb116857482c98b8b567f1c0bb Mon Sep 17 00:00:00 2001 From: Evan Goetz <32753745+eagoetz@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:33:06 -0700 Subject: [PATCH] Update Axes.grid keyword to use 'visible' (#383) 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 --- gwsumm/plot/builtin.py | 10 +++++----- gwsumm/plot/core.py | 2 +- gwsumm/plot/noisebudget.py | 4 ++-- gwsumm/plot/segments.py | 4 ++-- gwsumm/plot/triggers/core.py | 2 +- pyproject.toml | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gwsumm/plot/builtin.py b/gwsumm/plot/builtin.py index 54fa5020..ec84e8cc 100644 --- a/gwsumm/plot/builtin.py +++ b/gwsumm/plot/builtin.py @@ -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 ----------------------- @@ -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 @@ -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( @@ -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): @@ -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() diff --git a/gwsumm/plot/core.py b/gwsumm/plot/core.py index 269b0ebe..044b41b2 100644 --- a/gwsumm/plot/core.py +++ b/gwsumm/plot/core.py @@ -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) diff --git a/gwsumm/plot/noisebudget.py b/gwsumm/plot/noisebudget.py index 4364c68b..3257fe12 100644 --- a/gwsumm/plot/noisebudget.py +++ b/gwsumm/plot/noisebudget.py @@ -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( @@ -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( diff --git a/gwsumm/plot/segments.py b/gwsumm/plot/segments.py index 5fb87f3d..ba1172e1 100644 --- a/gwsumm/plot/segments.py +++ b/gwsumm/plot/segments.py @@ -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) @@ -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 diff --git a/gwsumm/plot/triggers/core.py b/gwsumm/plot/triggers/core.py index e3b08e14..025b500f 100644 --- a/gwsumm/plot/triggers/core.py +++ b/gwsumm/plot/triggers/core.py @@ -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) diff --git a/pyproject.toml b/pyproject.toml index a076a75b..ca47d933 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ dependencies = [ "lxml", "markdown", "MarkupPy", - "matplotlib >=3.1", + "matplotlib >=3.5", "numpy >=1.16", "pygments >=2.7.0", "python-dateutil",