Skip to content

Special-case usetex minus to zero depth. - #16366

Merged
tacaswell merged 1 commit into
matplotlib:masterfrom
anntzer:usetex-minus-depth
Jan 30, 2020
Merged

tacaswell merged 1 commit into
matplotlib:masterfrom
anntzer:usetex-minus-depth

Conversation

@anntzer

@anntzer anntzer commented Jan 29, 2020

Copy link
Copy Markdown
Contributor

This avoids vertical misalignment between e.g. "$1$" and "$-1$":

for x in [-1, 1]: figtext(.5, .5, f"${x}$", usetex=True, ha="right")

old (note the misalignment of baselines of "1"):
old
new:
new

Closes #6323, although more robust (and more complex...) solutions are discussed in #6323 (comment).

Mostly the same as #6333 which this supersedes, but here I explicitly only override the metrics for computer modern symbols (I have no idea whether other fonts have this problem), and added a test.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

This avoids vertical misalignment between e.g. "$1$" and "$-1$":
```
for x in [-1, 1]: figtext(.5, .5, f"${x}$", usetex=True, ha="right")
```
@anntzer anntzer added this to the v3.3.0 milestone Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertical alignment of tick labels with usetex=True

3 participants