Skip to content

Commit 90d94e5

Browse files
committed
Zorder cleanup
1 parent c067170 commit 90d94e5

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

proplot/axes.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ def colorbar(self, *args, loc=None, pad=None,
10621062
xmin, ymin, width, height = fbounds
10631063
patch = mpatches.Rectangle(
10641064
(xmin, ymin), width, height,
1065-
snap=True, zorder=4.5, transform=self.transAxes)
1065+
snap=True, zorder=4, transform=self.transAxes)
10661066
# Update patch props
10671067
alpha = _notNone(alpha, rc['colorbar.framealpha'])
10681068
linewidth = _notNone(linewidth, rc['axes.linewidth'])
@@ -1221,7 +1221,7 @@ def heatmap(self, *args, **kwargs):
12211221
)
12221222
return obj
12231223

1224-
def inset_axes(self, bounds, *, transform=None, zorder=5,
1224+
def inset_axes(self, bounds, *, transform=None, zorder=4,
12251225
zoom=True, zoom_kw=None, **kwargs):
12261226
"""
12271227
Like the builtin `~matplotlib.axes.Axes.inset_axes` method, but
@@ -1240,8 +1240,10 @@ def inset_axes(self, bounds, *, transform=None, zorder=5,
12401240
or `~matplotlib.figure.Figure.transFigure` transforms. Default is
12411241
``'axes'``, i.e. `bounds` is in axes-relative coordinates.
12421242
zorder : float, optional
1243-
The zorder of the axes, should be greater than the zorder of
1244-
elements in the parent axes. Default is ``5``.
1243+
The `zorder \
1244+
<https://matplotlib.org/3.1.1/gallery/misc/zorder_demo.html>`__
1245+
of the axes, should be greater than the zorder of
1246+
elements in the parent axes. Default is ``4``.
12451247
zoom : bool, optional
12461248
Whether to draw lines indicating the inset zoom using
12471249
`~Axes.indicate_inset_zoom`. The lines will automatically
@@ -3032,9 +3034,12 @@ def format(self, *,
30323034
# Longitude gridlines, draw relative to projection prime meridian
30333035
# NOTE: Always generate gridlines array on first format call
30343036
# because rc setting will be not None
3035-
# NOTE: Cartopy seems to need longitude lines to fall within
3036-
# -180 and 180. Also if they are not circular, latitude lines will
3037-
# not extend across entire sphere.
3037+
# NOTE: Cartopy needs monotonic levels for drawing gridlines or
3038+
# will get *overlapping* lines in places. But cartopy *also*
3039+
# needs labels between -180 and 180 for global plots even if
3040+
# longitude is shifted because GridLiner._axes_domain gets it
3041+
# wrong. For now use choose to allow overlapping gridlines as
3042+
# workaround. See #78.
30383043
if isinstance(self, GeoAxes):
30393044
lon_0 = self.projection.proj4_params.get('lon_0', 0)
30403045
else:
@@ -3224,7 +3229,7 @@ def _format_apply(self, patch_kw, lonlim, latlim, boundinglat,
32243229
# Initial gridliner object, which ProPlot passively modifies
32253230
# TODO: Flexible formatter?
32263231
if not self._gridliners:
3227-
gl = self.gridlines(zorder=5, draw_labels=False)
3232+
gl = self.gridlines(zorder=2.5) # below text only
32283233
gl.xlines = False
32293234
gl.ylines = False
32303235
try:
@@ -3310,7 +3315,6 @@ def _format_apply(self, patch_kw, lonlim, latlim, boundinglat,
33103315
}) # cached changes
33113316
gl.collection_kwargs.update(kw)
33123317
# Grid locations
3313-
# TODO: Check eps
33143318
eps = 1e-10
33153319
if lonlines is not None:
33163320
if len(lonlines) == 0:

0 commit comments

Comments
 (0)