omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Matplotlib russian fonts

    Pythonista
    3
    5
    3077
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • aerokuzbass
      aerokuzbass last edited by

      Hi, Dear!

      Please, help me!
      I can't use russian fonts on the matplotlib in pithonista 3.*
      Why?

      Best regards,

      MK

      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        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.

        1 Reply Last reply Reply Quote 2
        • aerokuzbass
          aerokuzbass last edited by

          Only rectangles instead of text :(

          ForceBru 1 Reply Last reply Reply Quote 0
          • ForceBru
            ForceBru @aerokuzbass last edited by ForceBru

            @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.

            1 Reply Last reply Reply Quote 0
            • aerokuzbass
              aerokuzbass last edited by

              Thank You, Bro!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors