File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1485,6 +1485,10 @@ def gca(self, **kwargs):
1485
1485
# continue and a new axes will be created
1486
1486
if key == ckey and isinstance (cax , projection_class ):
1487
1487
return cax
1488
+ else :
1489
+ warnings .warn ('Requested projection is different from '
1490
+ 'current axis projection, creating new axis '
1491
+ 'with requested projection.' )
1488
1492
1489
1493
# no axes found, so create one which spans the figure
1490
1494
return self .add_subplot (1 , 1 , 1 , ** kwargs )
Original file line number Diff line number Diff line change @@ -2279,6 +2279,11 @@ def polar(*args, **kwargs):
2279
2279
strings, as in :func:`~matplotlib.pyplot.plot`.
2280
2280
2281
2281
"""
2282
+ # If an axis already exists, check if it has a polar projection
2283
+ if gcf ().get_axes ():
2284
+ if not isinstance (gca (), PolarAxes ):
2285
+ warnings .warn ('Trying to create polar plot on an axis that does '
2286
+ 'not have a polar projection.' )
2282
2287
ax = gca (polar = True )
2283
2288
ret = ax .plot (* args , ** kwargs )
2284
2289
return ret
You can’t perform that action at this time.
0 commit comments