Thank you Michael,
I tried switching the matplotlib font to Dejavu Sans but it also does not
seem to recognize the lunate epsilon ϵ.
When I wrote title(u'ϵ-Fe'), it printed ε-Fe instead.
I tried several other fonts but the problem did not disappear.
It seems that the bes choice after all is to writ
(Sorry for the delay -- just back from vacation)
It looks like the default Vera Sans font that matplotlib uses doesn't
actually have the lunate epsilon character. If you have it installed,
you could have matplotlib use the DejaVu Sans font instead (which is
essentially Vera Sans with a larger
Thanks,
This unicode thing works like magic.
The only thing I am still unable to do is to insert the symbol \epsilon (as
distinct from \varepsilon).
For some reason, the varepsilon ε is printed fine, but a blank square is
printed instead of the lunate epsilon ϵ.
That is u' ε ' works, while u' ϵ' d
Yes, you would put it at the top of your .py file.
In order to use Unicode in Python source code, you have to tell the
Python interpreter what encoding the file is in. That's done with a
little "magic" comment at the top of the file. The popular Unixy
editors (emacs, vim etc.) also understand
Thanks,
This seems to be a solution.
I have an editor that supports unicode.
But, can you please explain better how do I make the coding directive at the
top of my source files ?
Where do I write the command:
# -*- coding: utf-8 -*-
Is it inside the python script ?
Sorry for the ignorance.
Eli
As an alternative, you could just use Unicode to insert the Greek
characters:
r"α-Fe (Someone 2003)"
The default font used by matplotlib, Vera Sans, includes a full set of
Greek characters. This, of course, requires an editor that supports
Unicode and a coding directive at the top of your sour
Here is the use case I have in mind:
Plotting properties of various phases of iron, I need a legend with greek
letters and normal text:
\alpha-Fe, Someone (2003)
Now, I need the names e.g. someone to be upright.
Also, the relbar between \alpha and Fe is shorter with normal text fonts
than with ita
Unfortunately there isn't. This is *theoretically* possible with the
STIX fonts, but that hasn't been implemented. However, with the
Computer Modern fonts, many of the glyphs simply aren't present (upright
Greek, for example) to make this happen.
That said, I'm not sure this is necessarily a
Hello
I there a way to change the default mathtext font from cal to rm ?
I would like to use the rm (serif) font without stating rm{...} or
mathrm{...}.
Is it possible to do using the matplotlibrc ?
can you give me an example of how this is done ?
Thanks
Eli
---