Russian labels without LaTeX

Hi, list!
  I want to use Russian or Ukrainian language in text within matplotlib plot.
There is solution, which I know - it is possible when text rendered with external LaTeX:

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}')

But LaTex is really large dependency, and many users don't want to install it. So my question.
Is it possible to use Russian or Ukrainian language in text within matplotlib plot in another way than using LaTeX?

Alexander Bruy

-- реклама -----------------------------------------------------------
Создай свой сайт бесплатно! www.hostpro.ua

I'm not an expert on this issue, and I never used Russian language.
But here is my experience with unicode in matplotlib.

Matplotlib's own font rendering engine (based on truetype) does
support unicode rendering. But I don't think there is any support for
things like a fontset. And, as far as you specify the font file to be
used, you can draw unicode text.
Here is an example (this is to draw some Korean text). Modify this for
your need.

-JJ

# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt

plt.rcParams["text.usetex"] = False
import matplotlib.font_manager as fm
fp1=fm.FontProperties(fname="/users/research/lee/.fonts/Eunjin.ttf")

plt.text(0.5, 0.5, u"한글", fontproperties=fp1)
plt.show()

2009/7/17 Alexander Bruy <voltron@...2684...>:

···

Hi, list!
I want to use Russian or Ukrainian language in text within matplotlib plot.
There is solution, which I know - it is possible when text rendered with external LaTeX:

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}')

But LaTex is really large dependency, and many users don't want to install it. So my question.
Is it possible to use Russian or Ukrainian language in text within matplotlib plot in another way than using LaTeX?

Alexander Bruy

-- реклама -----------------------------------------------------------
Создай свой сайт бесплатно! www.hostpro.ua

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I'm not an expert on this issue, and I never used Russian language.
But here is my experience with unicode in matplotlib.

Many thanks for your answer, Jae-Joon Lee!
It's work great. Thanks in advance!

Regards,
  Alexander Bruy

-- реклама -----------------------------------------------------------
Создай свой сайт бесплатно! www.hostpro.ua