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 8df6787

Browse filesBrowse files
committed
FIX: layout for mixed descent multiline text objects
1 parent f3e03d2 commit 8df6787
Copy full SHA for 8df6787

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+6
-4
lines changed

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,17 @@ def _get_layout(self, renderer):
324324
whs[i] = w, h
325325

326326
baseline = (h - d) - thisy
327-
thisy -= max(offsety, (h - d) * self._linespacing)
327+
if i > 0:
328+
thisy -= max(offsety, (h - d) * self._linespacing)
329+
else:
330+
thisy = -(h - d)
328331
horizLayout[i] = thisx, thisy, w, h
329332
thisy -= d
330333
width = max(width, w)
331334
descent = d
332335

333-
ymin = horizLayout[-1][1]
334-
ymax = horizLayout[0][1] + horizLayout[0][3]
336+
ymin = horizLayout[-1][1] - d
337+
ymax = 0
335338
height = ymax - ymin
336339
xmax = xmin + width
337340

@@ -351,7 +354,6 @@ def _get_layout(self, renderer):
351354
# the corners of the unrotated bounding box
352355
cornersHoriz = np.array(
353356
[(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)], float)
354-
cornersHoriz[:, 1] -= descent
355357

356358
# now rotate the bbox
357359
cornersRotated = M.transform(cornersHoriz)

0 commit comments

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