-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixes issue #1960. Account for right/top spine data offset on transform ... #1964
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
Fixes issue #1960. Account for right/top spine data offset on transform ... #1964
Conversation
…on transform when doing spine.set_position(). Also includes a testcase for the data locations.
@@ -323,6 +323,8 @@ def _calc_offset_transform(self): | |||
self._spine_transform = ('identity', | |||
mtransforms.IdentityTransform()) | |||
elif position_type == 'data': | |||
if self.spine_type in ('right', 'top'): | |||
amount -= 1 # translate left by one to account for right/top data offset of one |
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.
Sorry, the comment doesn't enlighten me. Do you know the root cause of this workaround? Is this one pixel? Are you certain that this isn't a snapping issue?
Apologies for the (possibly silly) questions - I would like to understand the underlying need for this change.
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.
It's not one pixel -- it's in axes units which are (0, 1) across the entire axis. Maybe a better comment would be:
The right and top spines have a default position of 1 in axes coordinates. When specifying the position in data coordinates, we need to calculate the position relative to 0.
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.
That is correct. I updated the code with Michael's suggested comment. Thanks @mdboom
# The right and top spines have a default position of 1 in | ||
# axes coordinates. When specifying the position in data | ||
# coordinates, we need to calculate the position relative to 0. | ||
amount -= 1 |
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.
Thanks @cimarronm - this is much clearer now.
Just needs an Nice work @cimarronm. 👍 |
How about:
Let me know if that is good or want to improve the wording for |
That sounds good to me. The |
Is this good to merge? |
…_fix Fixes issue #1960. Account for right/top spine data offset on transform ...
...when doing spine.set_position(). Also includes a testcase for the data locations.