From 671100fb36925232a7b3e54b502d3b6e3126e6f5 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 5 Mar 2018 10:30:40 +0000 Subject: [PATCH 1/2] Improve getting of polar axes in plt.polar() --- lib/matplotlib/pyplot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 From b519966971395093c1f7ec03160ca03eb433c5a4 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 5 Mar 2018 10:30:48 +0000 Subject: [PATCH 2/2] Add newlines to gca() warning --- lib/matplotlib/figure.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 ' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy