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

  • Home
  • SEARCH
  • 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 7559261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:35:32+00:00 2026-05-30T12:35:32+00:00

I have a problem with Matplotlib 1.0.1 I create a figure, and the I

  • 0

I have a problem with Matplotlib 1.0.1

I create a figure, and the I use an onclick event to do stuff when I click into the figure. One thing is, that it has to create a new figure with new data in it. This perfectly works in Matplotlib 0.99.3, where I developed the script, but now a collegue tried it on his machine, which has matplotlib 1.0.1 (and python 2.6 instead of 2.7), and the figure is not shown.

However, I think the figure is created, but not shown, because if I close the first figure, the script is not ended, it is still running.

Here is a simple example code:

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

a = [1,2,3]
b = [4,2,9]

line = ax.plot(a,b)

def onclick(event):
    print "clicked"
    a = [7,8,9]
    b = [1,9,20]
    fig2 = plt.figure()
    ax_single = fig2.add_subplot(111)
    line2 = ax_single.plot(a,b)

cid = fig.canvas.mpl_connect('button_press_event',onclick)
plt.show()

Is this a (known) bug in matplotlib 1.0.1? Is there any way around it?

Thx.

  • 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-30T12:35:32+00:00Added an answer on May 30, 2026 at 12:35 pm

    Adding a simple fig2.show() did the trick to me. Read the How-to to get more information!

    import matplotlib.pyplot as plt
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    
    a = [1,2,3]
    b = [4,2,9]
    
    line = ax.plot(a,b)
    
    def onclick(event):
        print "clicked"
        a = [7,8,9]
        b = [1,9,20]
        fig2 = plt.figure()
        ax_single = fig2.add_subplot(111)
        line2 = ax_single.plot(a,b)
        fig2.show()
    
    cid = fig.canvas.mpl_connect('button_press_event',onclick)
    plt.show()
    

    The was indeed a change in 1.0.0 in the way matplotlib handles figures after the mainloop has been started.

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

Sidebar

Related Questions

I have a matplotlib figure that I want to be able to switch between
I have a Python program that generates a histogram using matplotlib. The problem is
I have problem in some JavaScript that I am writing where the Switch statement
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with fancybox. I want to write a function that will run
I have a problem getting matplotlib 1.0.0 to work in Python 2.5.2 ( Ubuntu
I have a simple problem in python and matplotlib. I have 3 lists :
i have the following problem: Create a program where a particle will execute a
I have a matplotlib figure inside of a wxmpl panel, and am trying to
I have the following problem: I am using hist() in matplotlib.pyplot I am trying

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.