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

Skip to content

Commit 8aceadd

Browse files
committed
Fix string drawing on Python 3.x
1 parent 06d1b09 commit 8aceadd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/matplotlib/backends/backend_cairo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
200200
if angle:
201201
ctx.rotate (-angle * np.pi / 180)
202202
ctx.set_font_size (size)
203-
ctx.show_text (s.encode("utf-8"))
203+
if sys.version_info[0] < 3:
204+
ctx.show_text (s.encode("utf-8"))
205+
else:
206+
ctx.show_text (s)
204207
ctx.restore()
205208

206209
def _draw_mathtext(self, gc, x, y, s, prop, angle):

0 commit comments

Comments
 (0)