Skip to content

[Bug]: Matplotlib font error for negative data #28898

Closed
@JeltevL

Description

@JeltevL

Bug summary

When using a combination of text.usetex: True, font.family: 'serif', font.serif = 'Times', attempting to plot negative data results in a LookupError of the required font

Code for reproduction

import matplotlib.pyplot as plt

plt.rcParams['text.usetex'] = True
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.serif'] = 'Times'

fig, ax = plt.subplots()
ax.plot([-1, 2, 3])
fig.savefig('test.pdf')

Actual outcome

LookupError: An associated PostScript font (required by Matplotlib) could not be found for TeX font 'zptmcm7y' in 'C:/Users/XXX/AppData/Local/MiKTeX/fonts/map/pdftex/pdftex.map'; this problem can often be solved by installing a suitable PostScript font package in your TeX package manager

Expected outcome

A plot with the data in tex font

Additional information

Installing or re-installing a postscript font package using MikTeX did not solve the issue

Operating system

Windows 10

Matplotlib Version

3.9.2

Matplotlib Backend

module://backend_interagg

Python version

3.12.1

Jupyter version

No response

Installation

pip

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