8000 linespacing of multiline texts. · Issue #2078 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
linespacing of multiline texts. #2078
Closed
@leejjoon

Description

@leejjoon

The linespacing of multiline text in the current master branch needs some improvement.

Consider a following example,

import matplotlib.pyplot as plt
plt.figure(figsize=(7,3))
plt.text(0.2, 0.5, "TpTpTp\n$M$\nTpTpTp", size=20,
         ha="center", va="top")

plt.text(0.5, 0.5, "TpTpTp\n$M^{M^{M^{M}}}$\nTpTpTp", size=20,
         ha="center", va="top")

plt.text(0.8, 0.5, "TpTpTp\n$M_{q_{q_{q}}}$\nTpTpTp", size=20,
         ha="center", va="top")

plt.xlim(0, 1)
plt.ylim(0, 0.8)
plt.show()

Current master (and mdboom's issue2070 branch) produces following.

test_multiline_linespacing_master

Note that superscrips and subscripts overwarp with the line above and below.

In mpl 1.2,

test_multiline_linespacing_mpl1 2

The second looks good, though 3rd still overwrapps.

The desired behavior is (at least to me)

test_multiline_linespacing_okay

I have a working solution based on the v1.2.x branch. Once mdboom's issue2070 branch is merged into master, I will rebase and make a PR.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0