Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b736691

Browse files
authored
Merge pull request #25640 from QuLogic/pgf-text-clip
pgf: Add clipping to text outputs
2 parents b401bc2 + cfe9fb7 commit b736691

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
657657
s = _escape_and_apply_props(s, prop)
658658

659659
_writeln(self.fh, r"\begin{pgfscope}")
660+
self._print_pgf_clip(gc)
660661

661662
alpha = gc.get_alpha()
662663
if alpha != 1.0:

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def create_figure():
6767
ha='right', fontsize=20)
6868
plt.ylabel('sans-serif, blue, $\\frac{\\sqrt{x}}{y^2}$..',
6969
family='sans-serif', color='blue')
70+
plt.text(1, 1, 'should be clipped as default clip_box is Axes bbox',
71+
fontsize=20, clip_on=True)
7072

7173
plt.xlim(0, 1)
7274
plt.ylim(0, 1)

0 commit comments

Comments
 (0)