Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b33aabc

Browse filesBrowse files
authored
Merge pull request #10792 from jinshifen33/bugfix-for-issue-10105
Fixed not being able to set vertical/horizontal alignments in polar graphs
2 parents 31e9bfe + ad70feb commit b33aabc
Copy full SHA for b33aabc

File tree

Expand file treeCollapse file tree

3 files changed

+34
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+34
-2
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ def update_position(self, loc):
631631
text_angle = user_angle
632632
if self.label1On:
633633
if full:
634-
ha = 'left'
635-
va = 'bottom'
634+
ha = self.label1.get_ha()
635+
va = self.label1.get_va()
636636
else:
637637
ha, va = self._determine_anchor(mode, angle, direction > 0)
638638
self.label1.set_ha(ha)
Loading

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,38 @@ def test_polar_coord_annotations():
455455
ax.set_ylim(-20, 20)
456456

457457

458+
@image_comparison(baseline_images=['polar_alignment'], extensions=['png'])
459+
def test_polar_alignment():
460+
'''
461+
Test that changing the vertical/horizontal alignment of a polar graph
462+
works as expected '''
463+
ranges = [(0, 5), (0, 5)]
464+
465+
angles = np.arange(0, 360, 90)
466+
467+
levels = 5
468+
469+
fig = plt.figure()
470+
471+
figureSize = [0.1, 0.1, 0.8, 0.8]
472+
473+
horizontal = fig.add_axes(figureSize, polar=True, label='horizontal')
474+
vertical = fig.add_axes(figureSize, polar=True, label='vertical')
475+
476+
axes = [horizontal, vertical]
477+
478+
horizontal.set_thetagrids(angles)
479+
480+
vertical.patch.set_visible(False)
481+
482+
for i in range(2):
483+
grid = np.linspace(*ranges[i], num=levels)
484+
gridValues = [0, 0.2, 0.4, 0.6, 0.8, 1]
485+
axes[i].set_rgrids(gridValues, angle=angles[i],
486+
horizontalalignment='left',
487+
verticalalignment='top')
488+
489+
458490
@image_comparison(baseline_images=['fill_units'], extensions=['png'],
459491
savefig_kwarg={'dpi': 60})
460492
def test_fill_units():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.