Skip to content

Commit 0bbcfc4

Browse files
committed
Remove projection processing from subplots(), update add_subplot() docs
1 parent fc9a23d commit 0bbcfc4

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

proplot/subplots.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,12 @@ def add_subplot(self, *args,
14751475
The registered matplotlib projection name, or a basemap or cartopy
14761476
map projection name. For valid map projection names, see the
14771477
:ref:`Table of projections`.
1478+
1479+
Other parameters
1480+
----------------
1481+
**kwargs
1482+
Passed to `~matplotlib.figure.Figure.add_subplot`. Also passed
1483+
to `~proplot.proj.Proj` if this is a cartopy or basemap projection.
14781484
"""
14791485
# TODO: Consider permitting add_subplot?
14801486
# Copied from matplotlib add_subplot
@@ -2042,23 +2048,6 @@ def subplots(array=None, ncols=1, nrows=1,
20422048
proj = _axes_dict(naxs, proj, kw=False, default='cartesian')
20432049
proj_kw = _axes_dict(naxs, proj_kw, kw=True)
20442050
basemap = _axes_dict(naxs, basemap, kw=False, default=False)
2045-
axes_kw = {num:{} for num in range(1, naxs+1)} # stores add_subplot arguments
2046-
for num,name in proj.items():
2047-
# The default is CartesianAxes
2048-
if name is None or name == 'cartesian':
2049-
axes_kw[num]['projection'] = 'cartesian'
2050-
# Builtin matplotlib polar axes, just use my overridden version
2051-
elif name == 'polar':
2052-
axes_kw[num]['projection'] = 'polar2'
2053-
if num == ref:
2054-
aspect = 1
2055-
# Custom Basemap and Cartopy axes
2056-
else:
2057-
package = 'basemap' if basemap[num] else 'cartopy'
2058-
obj, iaspect = projs.Proj(name, basemap=basemap[num], **proj_kw[num])
2059-
if num == ref:
2060-
aspect = iaspect
2061-
axes_kw[num].update({'projection':package, 'map_projection':obj})
20622051

20632052
#-------------------------------------------------------------------------#
20642053
# Figure architecture
@@ -2180,9 +2169,8 @@ def subplots(array=None, ncols=1, nrows=1,
21802169
with fig._unlock():
21812170
axs[idx] = fig.add_subplot(subplotspec, number=num,
21822171
spanx=spanx, spany=spany, alignx=alignx, aligny=aligny,
2183-
sharex=sharex, sharey=sharey,
2184-
main=True,
2185-
**axes_kw[num])
2172+
sharex=sharex, sharey=sharey, main=True,
2173+
proj=proj[num], basemap=basemap[num], **proj_kw[num])
21862174

21872175
# Return figure and axes
21882176
n = (ncols if order == 'C' else nrows)

0 commit comments

Comments
 (0)