Skip to content

Commit

Permalink
Merge pull request #1964 from cimarronm/data_spine_right_top_location…
Browse files Browse the repository at this point in the history
…_fix

Fixes issue #1960. Account for right/top spine data offset on transform ...
  • Loading branch information
mdboom committed May 11, 2013
2 parents 1f07cb8 + 6f45b43 commit af07100
Show file tree
Hide file tree
Showing 6 changed files with 564 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ For new features that were added to matplotlib, please see
Changes in 1.3.x
================

* Fixed a bug in setting the position for the right/top spine with data
position type. Previously, it would draw the right or top spine at
+1 data offset.

* In :class:`~matplotlib.patches.FancyArrow`, the default arrow head width,
``head_width``, has been made larger to produce a visible arrow head. The new
value of this kwarg is ``head_width = 20 * width``.
Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ def _calc_offset_transform(self):
self._spine_transform = ('identity',
mtransforms.IdentityTransform())
elif position_type == 'data':
if self.spine_type in ('right', 'top'):
# 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
if self.spine_type in ('left', 'right'):
self._spine_transform = ('data',
mtransforms.Affine2D().translate(
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit af07100

Please sign in to comment.