Skip to content

ax.xaxis.set_major_locator will let matplotlib to throw error. #117

@cesaryuan

Description

@cesaryuan

Environment

System: Windows-10-10.0.22621-SP0
Python: 3.9.19 (main, May  6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)]
SciencePlots: 2.1.1
Matplotlib: 3.8.4
LaTeX distro:
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.8, 13-Jul-2019
compiled with curl version 8.4.0; using libcurl/8.4.0 Schannel
compiled with expat version 2.5; using expat_2.5.0
compiled with jpeg version 9.5
compiled with liblzma version 50040002; using 50040002
compiled with libpng version 1.6.39; using 1.6.39
compiled with libressl version LibreSSL 3.8.1; using LibreSSL 3.8.1
compiled with MiKTeX Application Framework version 4.8; using 4.8
compiled with MiKTeX Core version 4.24; using 4.24
compiled with MiKTeX Archive Extractor version 4.1; using 4.1
compiled with MiKTeX Package Manager version 4.10; using 4.10
compiled with uriparser version 0.9.7
compiled with xpdf version 4.04
compiled with zlib version 1.2.13; using 1.2.13

Affected styles

['science', 'ieee']

Describe the issue here

ax.xaxis.set_major_locator will let matplotlib to throw error.

LookupError: An associated PostScript font (required by Matplotlib) could not be found for TeX font 'zptmcm7y' in 'E:/scoop/apps/miktex/current/texmfs/data/fonts/map/pdftex/pdftex.map'; this problem can often be solved by installing a suitable PostScript font package in your TeX package manager

How can we replicate it? What have you tried? Please, add a reproducible example

from matplotlib import ticker
import matplotlib.pyplot as plt
import scienceplots

# If we comment out the following line, the code will run without error
plt.style.use(['science', 'ieee'])

fig, ax = plt.subplots()
ax.plot([1, 2, 3])

# If we comment out the following line, the code will run without error
ax.xaxis.set_major_locator(ticker.LinearLocator(numticks=5))

fig.savefig('test.pdf')

Extra info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions