Commit 39301db
Remove unnecessary Legend._approx_text_height. (#16312)
It is only ever called with renderer=None, returning the fontsize
directly. In fact the rest of the code assumes that the font size is
in points (inch/72), not in pixels. This can be checked by setting the
dpi to a large value (e.g. 500), forcing the renderer to be not None by
adding `renderer = self.figure.canvas._cachedRenderer` and making sure
that a cached renderer exists (via `fig.canvas.draw()`) before creating
the legend -- such a patch results in a highly distorted legend layout,
whereas just using fontsize is fine even at high dpi.1 parent 69cd8bf commit 39301db
1 file changed
Lines changed: 2 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | 613 | | |
624 | 614 | | |
625 | 615 | | |
| |||
731 | 721 | | |
732 | 722 | | |
733 | 723 | | |
734 | | - | |
| 724 | + | |
735 | 725 | | |
736 | | - | |
| 726 | + | |
737 | 727 | | |
738 | 728 | | |
739 | 729 | | |
| |||
0 commit comments