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

Skip to content

Commit c154674

Browse files
committed
Improved comment for data spine transform adjustment - taken from mdboom.
1 parent 247689d commit c154674

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/matplotlib/spines.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ def _calc_offset_transform(self):
324324
mtransforms.IdentityTransform())
325325
elif position_type == 'data':
326326
if self.spine_type in ('right', 'top'):
327-
amount -= 1 # translate left by one to account for right/top data offset of one
327+
# The right and top spines have a default position of 1 in
328+
# axes coordinates. When specifying the position in data
329+
# coordinates, we need to calculate the position relative to 0.
330+
amount -= 1
328331
if self.spine_type in ('left', 'right'):
329332
self._spine_transform = ('data',
330333
mtransforms.Affine2D().translate(

0 commit comments

Comments
 (0)