aerokuzbass
Sep 17, 2017 - 23:09
Hi, Dear!
Please, help me!
I can't use russian fonts on the matplotlib in pithonista 3.*
Why?
Best regards,
MK
Hi, Dear!
Please, help me!
I can't use russian fonts on the matplotlib in pithonista 3.*
Why?
Best regards,
MK
Hi, welcome!
Someone else had a similar problem with Greek letters: https://forum.omz-software.com/topic/2594/matplotlib-unicode-greek-letters. Maybe the solutions there work for Russian text too.
Only rectangles instead of text :(
@aerokuzbass, this is how I managed to output Cyrillic characters in Matplotlib:
import sys
import matplotlib.font_manager as fm
if sys.platform.lower() == 'ios':
fp = fm.FontProperties(fname = "/System/Library/Fonts/CoreAddition/Arial.ttf")
elif sys.platform.lower() == 'darwin': # for macOS
fp = fm.FontProperties(fname = '/Library/Fonts/Verdana.ttf')
else:
raise ValueError('Platform not supported:', sys.platform)
Then you do something like matplotlib.pyplot.title("Привет, мир!", fontproperties=fp). So, basically, you only need to choose a font to use to display the characters.
Thank You, Bro!