Skip to content

Commit 79b3e33

Browse files
committed
Hide fully transparent latex text in PS output.
This problem was fixed before for non-latex text. However, when using latex to render transparent text, it would still show up in PS output.
1 parent d358cc3 commit 79b3e33

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/matplotlib/backends/backend_ps.py

+3
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,9 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
593593
@_log_if_debug_on
594594
def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
595595
# docstring inherited
596+
if self._is_transparent(gc.get_rgb()):
597+
return # Special handling for fully transparent.
598+
596599
if not hasattr(self, "psfrag"):
597600
self._logwarn_once(
598601
"The PS backend determines usetex status solely based on "

lib/matplotlib/tests/test_backend_ps.py

+10
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ def test_transparency():
118118
ax.text(.5, .5, "foo", color="r", alpha=0)
119119

120120

121+
@needs_usetex
122+
@image_comparison(["empty.eps"])
123+
def test_transparency_tex():
124+
mpl.rcParams['text.usetex'] = True
125+
fig, ax = plt.subplots()
126+
ax.set_axis_off()
127+
ax.plot([0, 1], color="r", alpha=0)
128+
ax.text(.5, .5, "foo", color="r", alpha=0)
129+
130+
121131
def test_bbox():
122132
fig, ax = plt.subplots()
123133
with io.BytesIO() as buf:

0 commit comments

Comments
 (0)