Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cyrillic in matplotlib

I try to add some utf8 chars for figure legend and axis labels. This don't work. Found some example

#!/usr/bin/env pytnon
reset()
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')

but it also don't work correctly. I get latex error (when trying to save figure to *.svg) or wrong characters that obviously not cyrillic. What to do?

Cyrillic in matplotlib

I try to add some utf8 chars for figure legend and axis labels. This don't work. Found some example

#!/usr/bin/env pytnon
reset()
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')

but it also don't work correctly. I get latex error (when trying to save figure to *.svg) or wrong characters that obviously not cyrillic. What to do?

Cyrillic in matplotlib

I try to add some utf8 chars for figure legend and axis labels. This don't work. Found some example

#!/usr/bin/env pytnon
reset()
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')

but it also don't work correctly. I get latex error (when trying to save figure to *.svg) *.svg - "Package ucs Error: Unknown Unicode character 134 = U+0086") or wrong characters that obviously not cyrillic. What to do?

click to hide/show revision 4
retagged

Cyrillic in matplotlib

I try to add some utf8 chars for figure legend and axis labels. This don't work. Found some example

#!/usr/bin/env pytnon
reset()
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')

but it also don't work correctly. I get latex error (when trying to save figure to *.svg - "Package ucs Error: Unknown Unicode character 134 = U+0086") or wrong characters that obviously not cyrillic. What to do?