Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad611f3

Browse files
oscargustacaswell
authored andcommitted
Fix issue with empty line in ps backend
1 parente98d8d0 commitad611f3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎lib/matplotlib/backends/backend_ps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,9 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
665665
curr_stream[1].append(
666666
(item.x,item.ft_object.get_glyph_name(item.glyph_idx))
667667
)
668-
# append the last entry
669-
stream.append(curr_stream)
668+
# append the last entry if exists
669+
ifcurr_stream:
670+
stream.append(curr_stream)
670671

671672
self.set_color(*gc.get_rgb())
672673

‎lib/matplotlib/tests/test_backend_ps.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@ def test_linedash():
256256
assertbuf.tell()>0
257257

258258

259+
deftest_empty_line():
260+
# Smoke-test for gh#23954
261+
figure=Figure()
262+
ax=figure.add_subplot(111)
263+
ax.set_title('\nLower title')
264+
ax.annotate(text='\nLower label',xy=(0,0))
265+
buf=io.BytesIO()
266+
figure.savefig(buf,format='eps')
267+
figure.savefig(buf,format='ps')
268+
269+
259270
deftest_no_duplicate_definition():
260271

261272
fig=Figure()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp