1 | initial version |
I've encountered the same problem attempting label axes. In Sage 7.3 the following code:
plot(sin, 0, pi, axes_labels=(ur'Ось абсцисс $x$', ur'Ось ординат $y$'))
Yields warning and display no dummy-characters instead of Cyrillic letters:
MathTextWarning: Font 'default' does not have a glyph for '\u0441' [U441]
After some testing I ended up with the following code to prepare graphics to include in LaTeX, and it works in Sage 7.3 with Cyrillic letters as well (possibly requires Computer Modern Unicode font to be installed):
from matplotlib import rc
rc('text', usetex=True)
rc('text.latex', unicode=True)
rc('text.latex', preamble='\usepackage[utf8]{inputenc}')
rc('text.latex', preamble='\usepackage[russian]{babel}')
font = {'family': 'serif',
'serif': ['Computer Modern Unicode'],
'size': 12,
}
rc('font', **font)
plot(sin, 0, pi, axes_labels=(ur'Ось абсцисс $x$', ur'Ось ординат $y$'))
P.S. Before that issue resolved I had to rename all axes manually, so whoever fixed it or helped fixing it - many thanks!!!
2 | No.2 Revision |
I've encountered the same problem attempting label axes. axes with Cyrillic letters. In Sage 7.3 the following code:
plot(sin, 0, pi, axes_labels=(ur'Ось абсцисс $x$', ur'Ось ординат $y$'))
Yields warning and display no dummy-characters instead of Cyrillic letters:
MathTextWarning: Font 'default' does not have a glyph for '\u0441' [U441]
After some testing I ended up with the following code to prepare graphics to include in LaTeX, and it works in Sage 7.3 with Cyrillic letters as well (possibly requires Computer Modern Unicode font to be installed):
from matplotlib import rc
rc('text', usetex=True)
rc('text.latex', unicode=True)
rc('text.latex', preamble='\usepackage[utf8]{inputenc}')
rc('text.latex', preamble='\usepackage[russian]{babel}')
font = {'family': 'serif',
'serif': ['Computer Modern Unicode'],
'size': 12,
}
rc('font', **font)
plot(sin, 0, pi, axes_labels=(ur'Ось абсцисс $x$', ur'Ось ординат $y$'))
P.S. Before that issue resolved I had to rename all axes manually, so whoever fixed it or helped fixing it - many thanks!!!