Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Subscripts not displayed correctly for high dpi #18899

Closed
@swish42

Description

@swish42

Some subscripts seem to be incorrectly displayed in figures with high pixel density. For example, subscript + is shown correctly even for dpi=600, while subscript - or * are not shown correctly and the previous letter is cut off. This is similar to #4428, so apparently the issue has not been resolved.
Example:

import matplotlib.pyplot as plt
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
ax1.axis([0, 5, 0, 5])
ax1.text(2,4, '$X_-$', fontsize=25)
ax1.text(4,4, '$X_+$', fontsize=25)
ax1.text(2,2, '$X_*$', fontsize=25)

fig2 = plt.figure(dpi=600)
ax2 = fig2.add_subplot(111)
ax2.axis([0, 5, 0, 5])
ax2.text(2,4, '$X_-$', fontsize=25)
ax2.text(4,4, '$X_+$', fontsize=25)
ax2.text(2,2, '$X_*$', fontsize=25)

produces
correct
error

I am using matplotlib 3.3.2 with Python 3.7.8.

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