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 6848585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:53:12+00:00 2026-05-27T00:53:12+00:00

I understand how to display matplotlib plots on-screen using the pyplot interface (I think!).

  • 0

I understand how to display matplotlib plots on-screen using the pyplot interface (I think!). I started plotting in a multi-threaded program, and this started causing errors, so I am trying to switch to the object-oriented interface. I can make a simple plot and save to file using

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure

fig = Figure()
can = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot((1,2,3))
can.print_figure('test')

But how do I display this plot on the screen? I have seen other code that uses can.draw() but that has no effect.

Also, please let me know if there is anything suboptimal about my code above – I haven’t really got to grips with what all these figure, canvas and axes objects do yet.

  • 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-05-27T00:53:13+00:00Added an answer on May 27, 2026 at 12:53 am

    Your problem is that you’re using a non-interactive backend (Agg rather than TkAgg, GtkAgg, QtAgg, etc). By definition, it doesn’t support display to the screen.

    However, working with multithreaded code with any gui library will require that the gui’s mainloop be run in its own thread.

    In other words, switching to a backend that can display to the screen will require a good bit more complexity in your multithreaded code.

    There are several different ways to do this, but any generic method will be very inefficient. (The simple solution is to use pyplot.ion and then draw the canvas every x milliseconds in one thread while doing other things in another thread. This is horribly inefficient.)

    Can you give a bit more detail about what you’re doing? Why are you using threading instead of multiprocessing? (i.e. are you just doing a lot of IO?) What gui library are you using? (If you don’t know, then it’s probably Tk, as that’s the default matplotlib backend.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to understand this bit of code: in display.php: <html> ... <body> <table>
My code for display all days in this year. I don't understand why if
See this example: http://jsfiddle.net/EwtaC/1/ The images are styled via display:inline-block. I understand that whitespace
i don't understand why none of my display objects are not being removed. when
I understand how JS is run and I think I understand most of the
I understand the overall meaning of pointers and references(or at least I think i
I understand everything from this code: def display_meta(request): values = request.META.items() values.sort() html =
I understand it is useful to sanitize user input when you display it on
I am trying to understand how to use SyndicationItem to display feed which is
I'd like to have vim display my comments in italics, and I understand I

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.