Skip to content

Commit 5493f61

Browse files
committed
subplots() bugfix, calculate aspect from Proj return val
1 parent 44fb032 commit 5493f61

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

proplot/subplots.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,10 +2249,20 @@ def subplots(
22492249
# Custom Basemap and Cartopy axes
22502250
else:
22512251
package = 'basemap' if basemap[num] else 'geo'
2252-
obj, iaspect = projs.Proj(
2253-
name, basemap=basemap[num], **proj_kw[num])
2252+
obj = projs.Proj(
2253+
name, basemap=basemap[num], **proj_kw[num]
2254+
)
22542255
if num == ref:
2255-
aspect = iaspect
2256+
if basemap[num]:
2257+
aspect = (
2258+
(proj.urcrnrx - proj.llcrnrx)
2259+
/ (proj.urcrnry - proj.llcrnry)
2260+
)
2261+
else:
2262+
aspect = (
2263+
np.diff(proj.x_limits)
2264+
/ np.diff(proj.y_limits)
2265+
)[0]
22562266
axes_kw[num].update({'projection': package, 'map_projection': obj})
22572267

22582268
# Figure and/or axes dimensions

0 commit comments

Comments
 (0)