Skip to content

[Bug]: EPS export shows hidden tick labels when using tex for text rendering #21466

Closed
@yschroeder

Description

@yschroeder

Bug summary

When setting text.usetex: True, the EPS export produces spurious axis labels which are not visible in the PDF export.

This seems somewhat similar to #10163.

Code for reproduction

import matplotlib.pyplot as plt

# using tex shows spurious labels on the x axis
plt.rcParams.update({"text.usetex": True})

fig, axs = plt.subplots(1, 3, sharey=True)

# add a big axes, hide frame
hidden_ax = fig.add_subplot(111, frameon=False)

# hide tick and tick label of the big axes
plt.tick_params(labelcolor='none', top=False, bottom=False, left=False, right=False)

# comment in this workaround
# as suggested in https://github.com/matplotlib/matplotlib/issues/10163/
# hidden_ax.xaxis.set_major_locator(plt.NullLocator())
# hidden_ax.yaxis.set_major_locator(plt.NullLocator())

# save figures
fig.savefig("test.eps")
fig.savefig("test.pdf")

Actual outcome

broken_eps

Expected outcome

working_pdf

Operating system

Arch

Matplotlib Version

3.4.3

Matplotlib Backend

Qt5Agg

Python version

3.9.7

Jupyter version

No response

Other libraries

texlive-core 2021.58710-2
texlive-bin 2021.58686-3

Installation

Linux package manager (Debian/Fedora/etc.)

Conda channel

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions