Skip to content

Hide fully transparent latex text in PS output #21470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
@_log_if_debug_on
def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
# docstring inherited
if self._is_transparent(gc.get_rgb()):
return # Special handling for fully transparent.

if not hasattr(self, "psfrag"):
self._logwarn_once(
"The PS backend determines usetex status solely based on "
Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ def test_transparency():
ax.text(.5, .5, "foo", color="r", alpha=0)


@needs_usetex
@image_comparison(["empty.eps"])
def test_transparency_tex():
mpl.rcParams['text.usetex'] = True
fig, ax = plt.subplots()
ax.set_axis_off()
ax.plot([0, 1], color="r", alpha=0)
ax.text(.5, .5, "foo", color="r", alpha=0)


def test_bbox():
fig, ax = plt.subplots()
with io.BytesIO() as buf:
Expand Down