diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index dc29c4791046..54054970c8a3 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1822,11 +1822,12 @@ def gca(self, **kwargs): "3.0", "Calling `gca()` using the same arguments as a " "previous axes currently reuses the earlier " - "instance. In a future version, a new instance will " - "always be created and returned. Meanwhile, this " - "warning can be suppressed, and the future behavior " - "ensured, by passing a unique label to each axes " - "instance.") + "instance.\n" + "In a future version, a new instance will " + "always be created and returned.\n" + "Meanwhile, this warning can be suppressed, and the " + "future behavior ensured, by passing a unique label " + "to each axes instance.") return cax else: warnings.warn('Requested projection is different from ' diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 791c9bf90ad9..e69555baffb9 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2283,12 +2283,15 @@ def polar(*args, **kwargs): strings, as in :func:`~matplotlib.pyplot.plot`. """ - # If an axis already exists, check if it has a polar projection + # If an axes already exists, check if it has a polar projection if gcf().get_axes(): if not isinstance(gca(), PolarAxes): warnings.warn('Trying to create polar plot on an axis that does ' 'not have a polar projection.') - ax = gca(polar=True) + ax = gca() + else: + ax = gcf().add_subplot(1, 1, 1, polar=True) + ret = ax.plot(*args, **kwargs) return ret