-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
support vertical quiverkey #4516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
|
|
@@ -211,6 +211,9 @@ | |
| A dictionary with keyword arguments accepted by the | ||
| :class:`~matplotlib.font_manager.FontProperties` initializer: | ||
| *family*, *style*, *variant*, *size*, *weight* | ||
|
|
||
| *vswap*: | ||
| Swap the horizontal key to a vertical key | ||
|
|
||
| Any additional keyword arguments are used to override vector | ||
| properties taken from *Q*. | ||
|
|
@@ -240,6 +243,8 @@ def __init__(self, Q, X, Y, U, label, **kw): | |
| self.color = kw.pop('color', None) | ||
| self.label = label | ||
| self._labelsep_inches = kw.pop('labelsep', 0.1) | ||
| self._vswap = kw.pop('vswap', False) | ||
| vswap = {True: 'vertical', False: 0} | ||
| self.labelsep = (self._labelsep_inches * Q.ax.figure.dpi) | ||
|
|
||
| # try to prevent closure over the real self | ||
|
|
@@ -267,6 +272,7 @@ def on_dpi_change(fig): | |
| text=label, # bbox=boxprops, | ||
| horizontalalignment=self.halign[self.labelpos], | ||
| verticalalignment=self.valign[self.labelpos], | ||
| rotation=vswap[self._vswap], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be rotation='vertical' if self._vswap else 'horizontal', |
||
| fontproperties=font_manager.FontProperties(**_fp)) | ||
|
|
||
| if self.labelcolor is not None: | ||
|
|
@@ -295,8 +301,12 @@ def _init(self): | |
| # Hack: save and restore the Umask | ||
| _mask = self.Q.Umask | ||
| self.Q.Umask = ma.nomask | ||
| self.verts = self.Q._make_verts(np.array([self.U]), | ||
| np.zeros((1,))) | ||
| if self._vswap: | ||
| self.verts = self.Q._make_verts(np.zeros((1,)), | ||
| np.array([self.U])) | ||
| else: | ||
| self.verts = self.Q._make_verts(np.array([self.U]), | ||
| np.zeros((1,))) | ||
| self.Q.Umask = _mask | ||
| self.Q.pivot = _pivot | ||
| kw = self.Q.polykw | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use pop, add it as a kwarg in the call signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And where you are at it can you move the rest of the things that use
popup into the signature?