Skip to content

[Bug]: Minus sign subscript in legend disappears in math mode for font sizes larger than 25 + part of legend symbol does not show for large fonts #21693

@gullbrekken

Description

@gullbrekken

Bug summary

There are two problems here. They might be related so I put them both in the bug report.

1: I want to write $\sigma_{-}^{asdf}$ with asdf as superscript and - as subscript in the legend. When I use font size larger than 25, i.e. from 26 and upwards, the - sign disappears.

2: Also, when I write $\sigma_{-}$ the lowest part of the \sigma symbol does not show in the legend for font sizes larger than 23, i.e. from 24 and upwards.

Code for reproduction

import matplotlib.pyplot as plt
plt.rc('font', size=26) # set font size in plots

fig, ax = plt.subplots(figsize=(12, 12))

x = [1,2,3,4]
y = [1,2,3,4]

ax.plot(x, y, label=r'$\sigma^{asdf}$')
ax.plot(x, y, label=r'$\sigma_{-}$')
ax.plot(x, y, label=r'$\sigma_{-}^{asdf}$')
ax.plot(x, y, label=r'$\sigma_{+}^{asdf}$')
ax.legend()
plt.show()

Actual outcome

fig

Expected outcome

  1. Both superscript and - subscript shows for larger font sizes (up to a sensible value).
  2. Entire math symbol shows for larger font sizes (up to a sensible value).

Additional information

No response

Operating system

Windows 10

Matplotlib Version

3.4.3

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.8.12

Jupyter version

6.4.6

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions