python - Writing Greek in matplotlib labels, titles -
I'm trying to write some text for labels, shape titles etc. with my plots, but no benefit till now Has not happened .
I do not want to print specific characters (I know how to use special characters), I want to write the entire text in Greek (maybe Unicode and , suggesting that I would like to mention that for some reason I can not get matplotlib to cooperate with Tex (using IPython notebook from Anaconda in Ubuntu 14.10) so that there really is an option Will not be the first. I tried loading the Arial font and it loads successfully but again I get square blocks instead of characters. I And then to display the string I I managed to resolve the problem by doing the following: First of all, you To make sure that the necessary libraries are imported and installed on a computer, Greek render (font like Ubuntu Ubuntu font, set to bold in the following code). Then you can apply the selected label to each label, title etc. as follows: If that does not work, try adding the following line at the beginning of the file: A sample plot is provided to prove the purity of: You should give something like this: text '?).
import matplotlib.font_manager FM PROP = FM Font Properties (fname = '/ usr / share / fonts / truetype / msttcorefonts / Arial.ttf')
u'Î? ? I ?? Î¿Ï ?? ÎμÎ »second ?? μΠ± i ?? I ± i ?? I ?? Used ο किया? ? Î¿Î¼Î¿Î¯Ï ?? I ?? I · I ?? '. Ariel is considered to be fully presented to Greek and I have used it many times in text editors.
import matplotlib.font_manager to FM fp1 = fm.FontProperties (fname = '/ usr / share / fonts / truetype / ubuntu-font-family / Ubuntu-bttf')
plt.title (u "Î¤Î¯Ï ?? Î »Î¿Ï ?? I ?? Î¿Ï ?? Î³Ï ?? I ± I ?? ήμΠ± I ?? Î¿Ï ??", fontproperties = FP1)
# - * - coding: utf-8 - * -
Comments
Post a Comment