Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 247689d

Browse files
committed
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.
1 parent decbc33 commit 247689d

5 files changed

Lines changed: 557 additions & 0 deletions

File tree

lib/matplotlib/spines.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ def _calc_offset_transform(self):
323323
self._spine_transform = ('identity',
324324
mtransforms.IdentityTransform())
325325
elif position_type == 'data':
326+
if self.spine_type in ('right', 'top'):
327+
amount -= 1 # translate left by one to account for right/top data offset of one
326328
if self.spine_type in ('left', 'right'):
327329
self._spine_transform = ('data',
328330
mtransforms.Affine2D().translate(
Binary file not shown.
13.5 KB
Loading

0 commit comments

Comments
 (0)