MatPlotLib can't plot correctly figures with cyrillic symbols

265 views
Skip to first unread message

avi9526

unread,
Apr 16, 2012, 1:33:43 PM4/16/12
to sage-s...@googlegroups.com
I have Ubuntu 11.10 and SageMath 4.8 (build from source)
Next code works in Python 2.7 console and fail when using SageMath 4.8
#------------------------------------------
from matplotlib import rc
rc('font',**{'family':'serif'})
rc('text', usetex=True)
rc('text.latex',unicode=True)
rc('text.latex',preamble='\usepackage[utf8]{inputenc}')
rc('text.latex',preamble='\usepackage[russian]{babel}')
from pylab import *
x = linspace(0,2*pi,100)
y = sin(x)
plot(x,y,'-')
xlabel(u"ось абсцисс")
ylabel(u"ось ординат")
savefig('1.png')
#------------------------------------------
I get error "Package ucs Error: Unknown Unicode character 140 = U+008C". I open temporary *.tex file that caused to error (in "$HOME/.sage/matplotlib-1.0.1/tex.cache" directory) and find out that string "ось абсцисс" have wrong encoding in *.tex file and looks like "Ð¾Ñ ÑŒ Ð°Ð±Ñ Ñ†Ð¸Ñ Ñ ". Since that code works in Python console I think this problem is fault of SageMath.
Reply all
Reply to author
Forward
0 new messages