FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed not being able to set vertical/horizontal alignments in polar graphs · Pull Request #10792 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .png  (1) .py  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions lib/matplotlib/projections/polar.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
32 changes: 32 additions & 0 deletions lib/matplotlib/tests/test_axes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

Back | FazBrowse Home | New Git URL