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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:29:04+00:00 2026-06-10T16:29:04+00:00

I am using matplotlib inside of a wxpython GUI. In short, I have plotted

  • 0

I am using matplotlib inside of a wxpython GUI. In short, I have plotted a bunch of data. I then click on a data point (using DataCursor found at:

Is there a matplotlib equivalent of MATLAB's datacursormode?

or

Pop up annotations on matplotlib within wxPython

The second link is my actual implementation. I refrense the datacursor class from other classes. What i’m wondering, how do i remove the annotation by clicking an event button? For instance, I have an event button that updates my scatter plot (by using plot_handle.set_data and not by clearing the figure). However, the annotation remains exactly where it was regardless if the point is there or not. How do i remove it?

Thanks!

  • 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-10T16:29:06+00:00Added an answer on June 10, 2026 at 4:29 pm

    Most matplotlib objects have a remove() function (I think it is inherited from Artist). Just call that on the object you want to remove.

    Edit:

    If you have

    dc = DataCursor(...) # what ever aruguements you give it
    # bunch of code
    dc.annotation.remove()
    del dc
    plt.draw() # need to redraw to make remove visible
    

    Python has no notion of ‘private’ attributes, so you can just reach inside you object and call remove on the annotation. See tutorial on classes for more details.

    The down side of this is that now you have an object is a strange state. If you have any other references to it, they might behave badly. If you want to keep the DataCursor object around you can modify the annotation object using it’s set_* functions or change it’s visibility to temporarily hide it (doc)

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

Sidebar

Related Questions

I am plotting things using matplotlib and Basemap (within a wxpython gui). Currently, my
I am using a Matplotlib plot (with Basemap) inside of a wxPython pane. I
I have a bunch of points that I am trying to plot using matplotlib.
While plotting using Matplotlib, I have found how to change the font size of
I deal with simulation data and have been using matplotlib a lot lately and
I'm using matplotlib to plot data as a function of time in hh:mm:ss.ms format
I'm using matplotlib and Python 2.7 I have a MxN matrix of tuples, an
I am using matplotlib and Tkinter to plot some data. When I press a
I'm using matplotlib to plot some data as 2D curves in a 3D axes.
I am using Matplotlib to create an image based on some data. All of

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.