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

Text rotation patch by Alex-Carter01 · Pull Request #19114 · matplotlib/matplotlib · GitHub

Repository navigation

Closed
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
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.
11 changes: 11 additions & 0 deletions lib/matplotlib/tests/test_text.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 @@ -709,3 +709,14 @@ def test_update_mutate_input():
t.update(inp)
assert inp['fontproperties'] == cache['fontproperties']
assert inp['bbox'] == cache['bbox']

@image_comparison(['rotation_center_baseline.png'])
def test_rotation():
plt.plot([0, 1], lw=0)
plt.axvline(.5, linewidth=.5, color='.5')
plt.axhline(.5, linewidth=.5, color='.5')
N = 4
r = 0
plt.text(.5, .5, 'pP', size=100, rotation=r/N*360, va='center_baseline', rotation_mode='anchor')
r = 2
plt.text(.5, .5, 'pP', size=100, rotation=r/N*360, va='center_baseline', rotation_mode='anchor')
2 changes: 1 addition & 1 deletion lib/matplotlib/text.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 @@ -423,7 +423,7 @@ def _get_layout(self, renderer):
elif valign == 'baseline':
offsety = ymax1 - baseline
elif valign == 'center_baseline':
offsety = ymax1 - baseline / 2.0
offsety = ymax1 - baseline - ymin1
else:
offsety = ymin1

Expand Down

Back | FazBrowse Home | New Git URL