Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4534759

Browse filesBrowse files
committed
Fix #5281: Include ticks in tight bounding box
1 parent f924f39 commit 4534759
Copy full SHA for 4534759

File tree

Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,6 @@ def _get_tick_bboxes(self, ticks, renderer):
10491049
Given the list of ticks, return two lists of bboxes. One for
10501050
tick lable1's and another for tick label2's.
10511051
"""
1052-
10531052
ticklabelBoxes = []
10541053
ticklabelBoxes2 = []
10551054

@@ -1065,7 +1064,7 @@ def _get_tick_bboxes(self, ticks, renderer):
10651064
def get_tightbbox(self, renderer):
10661065
"""
10671066
Return a bounding box that encloses the axis. It only accounts
1068-
tick labels, axis label, and offsetText.
1067+
tick labels, axis label, offsetText and ticks.
10691068
"""
10701069
if not self.get_visible():
10711070
return
@@ -1088,6 +1087,10 @@ def get_tightbbox(self, renderer):
10881087
bb.extend(ticklabelBoxes)
10891088
bb.extend(ticklabelBoxes2)
10901089

1090+
bb.extend(
1091+
tick._get_tick2line().get_window_extent(renderer)
1092+
for tick in ticks_to_draw)
1093+
10911094
bb = [b for b in bb if b.width != 0 or b.height != 0]
10921095
if bb:
10931096
_bbox = mtransforms.Bbox.union(bb)

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def get_window_extent(self, renderer):
568568
ignore=True)
569569
# correct for marker size, if any
570570
if self._marker:
571-
ms = (self._markersize / 72.0 * self.figure.dpi) * 0.5
571+
ms = (self._markersize / 72.0 * self.figure.dpi)
572572
bbox = bbox.padded(ms)
573573
return bbox
574574

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.