From a46654a103b1d234e5ebe638824ce9f0fddbf9de Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 29 Jul 2021 11:54:15 +0100 Subject: [PATCH 1/3] Remove unneeded check --- mapgenerator/plotting/timeseries.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mapgenerator/plotting/timeseries.py b/mapgenerator/plotting/timeseries.py index 045ced7..57c097c 100644 --- a/mapgenerator/plotting/timeseries.py +++ b/mapgenerator/plotting/timeseries.py @@ -307,9 +307,4 @@ class DateFormatter(ticker.Formatter): self.fmt = fmt def __call__(self, x, pos=0): - if x == 0: - raise ValueError('DateFormatter found a value of x=0, which is ' - 'an illegal date; this usually occurs because ' - 'you have not informed the axis that it is ' - 'plotting dates, e.g., with ax.xaxis_date()') return self.units.num2date(x).strftime(self.fmt) -- GitLab From bf9049ba3ee4a5ced791798d743fa95d6b4a1688 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 29 Jul 2021 11:54:53 +0100 Subject: [PATCH 2/3] Remove deprec warnings and improve colorbar --- mapgenerator/plotting/plotmap.py | 56 +++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/mapgenerator/plotting/plotmap.py b/mapgenerator/plotting/plotmap.py index 037df99..8fcae03 100644 --- a/mapgenerator/plotting/plotmap.py +++ b/mapgenerator/plotting/plotmap.py @@ -196,6 +196,8 @@ class PlotMap(MapCross, MapDrawOptions): def set_color_bar(self, mco, location='right', drawedges=False, cax=None): """ Create color bar """ + if not location: + return mpl.rcParams['axes.linewidth'] = 0.1 mpl.rcParams['axes.formatter.useoffset'] = False if self.ticks: @@ -203,25 +205,39 @@ class PlotMap(MapCross, MapDrawOptions): self.ticks = parse_parameters_list(self.ticks) elif self.bounds: self.ticks = self.bounds + while len(self.ticks) > 10: + self.ticks = self.ticks[0::2] elif hasattr(mco, 'levels'): self.ticks = mco.levels LOG.debug("***** Formats: %s *****", self.formats) - pad = {'bottom': 0.05, 'right': 0.02} - pad = pad.get(location, 0.02) - cax, kwargs = mpl.colorbar.make_axes(self.mgaxis, - location=location, - pad=pad, - shrink=0.9) - cbar = self.mgplot.colorbar(mco, - cax=cax, - ax=self.mgaxis, - ticks=self.ticks, - format=self.formats, - pad=.06, - extend=self.extend, - drawedges=drawedges, - **kwargs) + if self.subplot: + orientation = { + 'right': 'vertical', + 'bottom': 'horizontal', + } + cbar = self.mgplot.colorbar(mco, + ax=self.mgaxis, + ticks=self.ticks, + format=self.formats, + pad=.15, + drawedges=drawedges, + orientation=orientation[location]) + else: + pad = {'bottom': 0.05, 'right': 0.02} + pad = pad.get(location, 0.02) + cax, kwargs = mpl.colorbar.make_axes(self.mgaxis, + location=location, + pad=pad, + shrink=0.9) + cbar = self.mgplot.colorbar(mco, + cax=cax, + ax=self.mgaxis, + ticks=self.ticks, + format=self.formats, + pad=.06, + drawedges=drawedges, + **kwargs) cbar.ax.tick_params(labelsize=float(self.coordsopts[1])) for lin in cbar.ax.yaxis.get_ticklines(): lin.set_visible(False) @@ -583,8 +599,8 @@ class PlotMap(MapCross, MapDrawOptions): ) if self.draw_labels and bool(self.projection == 'PlateCarree'): - grl.xlabels_top = False - grl.ylabels_right = False + grl.top_labels = False + grl.right_labels = False if self.draw_labels: grl.xlabel_style = {'size': float(self.coordsopts[1])} grl.ylabel_style = grl.xlabel_style @@ -860,8 +876,10 @@ class PlotMap(MapCross, MapDrawOptions): else: self.mgaxis = plt.subplot(self.subplot[0], self.subplot[1], - self.subplot[3], - projection=self._crs) + self.subplot[2], + projection=self._crs, + sharex=True, + sharey=True,) self.mgplot = plt.gcf() valid_tmp = dims[n_time] -- GitLab From 20bf853b0afa0eff34a60cb389284ebf4d717d0a Mon Sep 17 00:00:00 2001 From: Francesco Date: Wed, 27 Oct 2021 09:39:13 +0000 Subject: [PATCH 3/3] Update __init__.py --- mapgenerator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapgenerator/__init__.py b/mapgenerator/__init__.py index 41b1c3f..c3c8e3f 100644 --- a/mapgenerator/__init__.py +++ b/mapgenerator/__init__.py @@ -1,4 +1,4 @@ """ Map Generator is a toolkit that provides easy to use 2D plotting and evaluation functions for Earth Sciences """ -__version__ = "1.0.2" +__version__ = "1.0.3" -- GitLab