0

Simple command I try to run:

sage: Graph({'Б':[1,2]}).plot().save('/tmp.plot.png')

fails:

/usr/lib/sagemath/local/lib/python2.7/site-packages/matplotlib-1.5.1-py2.7-linux-x86_64.egg/matplotlib/text.py in set_text(self, s)
   1204         ACCEPTS: string or anything printable with '%s' conversion.
   1205         """
-> 1206         self._text = '%s' % (s,)
   1207         self.stale = True
   1208 

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Can someone help with this?

SageMath version 7.2, Release Date: 2016-05-15

Sergey
  • 19,487
  • 13
  • 44
  • 68

1 Answers1

1

Apparently the way we use matplotlib doesn't allow non-ascii strings. See Trac 21008.

Update: This ticket now has a fix and positive review, so hopefully it will be in Sage 7.3, or possibly 7.4 depending on how fast 7.3 gets out.

kcrisman
  • 4,374
  • 20
  • 41
  • So bug is in Sage, not matplotlib? – Sergey Jul 12 '16 at 17:19
  • 1
    Not exactly. See http://stackoverflow.com/questions/10960463/non-ascii-characters-in-matplotlib and https://trac.sagemath.org/ticket/21008#comment:1 - you have to pass this as a unicode string explicitly. – kcrisman Jul 12 '16 at 19:31