Skip to content

Commit c564baf

Browse files
committed
fix wrong baseline for multiple line legend
svn path=/branches/v1_0_maint/; revision=8564
1 parent 53f6a70 commit c564baf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/offsetbox.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -641,14 +641,14 @@ def get_extent(self, renderer):
641641
bbox, info = self._text._get_layout(renderer)
642642
w, h = bbox.width, bbox.height
643643

644-
line = info[0][0] # first line
645-
644+
line = info[-1][0] # last line
646645
_, hh, dd = renderer.get_text_width_height_descent(
647646
line, self._text._fontproperties, ismath=ismath)
648-
647+
d = dd # the baseline of the last line
649648

650649
self._baseline_transform.clear()
651-
d = h-(hh-dd) # the baseline of the first line
650+
651+
652652
if len(info) > 1 and self._multilinebaseline:
653653
d_new = 0.5 * h - 0.5 * (h_ - d_)
654654
self._baseline_transform.translate(0, d - d_new)

0 commit comments

Comments
 (0)