Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8104201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:46:03+00:00 2026-06-05T23:46:03+00:00

I have a problem displaying non- ASCII characters in Matplotlib, these characters are rendered

  • 0

I have a problem displaying non-ASCII characters in Matplotlib, these characters are rendered as small boxes instead of a proper font, it looks like (I filled these boxes with red paint to hightlight them):

Here is the image showing the problem

How do I fix it?

A related question is Accented characters in Matplotlib.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:46:05+00:00Added an answer on June 5, 2026 at 11:46 pm

    This problem may actually have a couple of different causes:

    The default font does not include these glyphs

    You may change the default font using the following (before any plotting is done!)

    matplotlib.rc('font', family='Arial')
    

    In some versions of matplotlib you’ll have to set the family:

    matplotlib.rc('font', **{'sans-serif' : 'Arial',
                             'family' : 'sans-serif'})
    

    (Note that because sans-serif contains a hyphen inside the **{} syntax, it is actually necessary.)

    The first command changes the sans-serif font family to contain only one font (in my case it was Arial), the second sets the default font family to sans-serif.

    Other options are included in the documentation.

    You have improperly created/passed string objects into Matplotlib

    Even if the font contains proper glyphs, if you forgot to use u to create Unicode constants, Matplotlib will have this behaviour:

    plt.xlabel("Średnia odległość między stacjami wsparcia a modelowaną [km]")
    

    So you need to add u:

    plt.xlabel(u"Średnia odległość między stacjami wsparcia a modelowaną [km]")
    

    Another cause is that you forgot to put a UTF-8 magic comment on top of the file (I read that this might be the source of the problem):

    # -*- coding: utf-8 -*-
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem displaying the swedish characters åäö, read from my database, in
I have problem with displaying adsense ads in ie7 google adsense adds an iframe
I have a problem consistently displaying Facebook Comments on my AJAX driven website. Each
I have problem with HTTP headers, they're encoded in ASCII and I want to
I have problem in displaying drop-down menu. Please, see the example on: http://staging.gwynconsulting.com/rif/hello-world-2/ When
I have a problem displaying the results of an sql query into a ListView
I have problem displaying images.... It works perfectly on simulator but on iphone device
I have problem with displaying bitmap image on imageview on high density screen (480x800).
I have a problem displaying validation errors that are triggered by ui components which
I have a problem displaying UITableView : Some cells are empty, and content in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.