diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index fb139ff01cb3..73b78d24dba1 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -631,8 +631,8 @@ def update_position(self, loc): text_angle = user_angle if self.label1On: if full: - ha = 'left' - va = 'bottom' + ha = self.label1.get_ha() + va = self.label1.get_va() else: ha, va = self._determine_anchor(mode, angle, direction > 0) self.label1.set_ha(ha) diff --git a/lib/matplotlib/tests/baseline_images/test_axes/polar_alignment.png b/lib/matplotlib/tests/baseline_images/test_axes/polar_alignment.png new file mode 100644 index 000000000000..c6f745275e85 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes/polar_alignment.png differ diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 479e55b37251..0d85e85447b7 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -454,6 +454,38 @@ def test_polar_coord_annotations(): ax.set_ylim(-20, 20) +@image_comparison(baseline_images=['polar_alignment'], extensions=['png']) +def test_polar_alignment(): + ''' + Test that changing the vertical/horizontal alignment of a polar graph + works as expected ''' + ranges = [(0, 5), (0, 5)] + + angles = np.arange(0, 360, 90) + + levels = 5 + + fig = plt.figure() + + figureSize = [0.1, 0.1, 0.8, 0.8] + + horizontal = fig.add_axes(figureSize, polar=True, label='horizontal') + vertical = fig.add_axes(figureSize, polar=True, label='vertical') + + axes = [horizontal, vertical] + + horizontal.set_thetagrids(angles) + + vertical.patch.set_visible(False) + + for i in range(2): + grid = np.linspace(*ranges[i], num=levels) + gridValues = [0, 0.2, 0.4, 0.6, 0.8, 1] + axes[i].set_rgrids(gridValues, angle=angles[i], + horizontalalignment='left', + verticalalignment='top') + + @image_comparison(baseline_images=['fill_units'], extensions=['png'], savefig_kwarg={'dpi': 60}) def test_fill_units(): 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