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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:54:17+00:00 2026-06-04T20:54:17+00:00

I have a list of handles to points that have been plotted using matplotlib.pyplot

  • 0

I have a list of handles to points that have been plotted using matplotlib.pyplot like so:

import matplotlib.pyplot as plt
...

for i in range(0,len(z)):
    zh[i] = plt.plot(z[i].real, z[i].imag, 'go', ms=10)
    plt.setp(zh[i], markersize=10.0, markeredgewidth=1.0,markeredgecolor='k', markerfacecolor='g')

I’d also like to extract the XData and YData from the handles somewhere else in the code (z[i].real and z[i].imag would have changed by then). However, when I do this:

for i in range(1,len(zh)):
    print zh[i]
    zx = get(zh[i],'XData')
    zy = get(zh[i],'YData')

I get this (first line is a result of the “print zh[i]” above):

[<matplotlib.lines.Line2D object at 0x048FDA70>]

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
  return self.func(*args)
...
File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 1130, in getp
  func = getattr(obj, 'get_' + property)
AttributeError: 'list' object has no attribute 'get_XData'

EDIT

I simplified the problem down to this:

new_handler = plt.plot(0.5, 0, 'go', ms=10)
plt.setp(new_handler, markersize=10.0, markeredgewidth=1.0,markeredgecolor='k',markerfacecolor='g',picker=5)
print plt.getp(new_handler,'xdata')

Still same error:

AttributeError: 'list' object has no attribute 'get_xdata'
  • 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-04T20:54:19+00:00Added an answer on June 4, 2026 at 8:54 pm

    Here is the solution:

    import matplotlib.pyplot as plt
    
    # plot returns a list, therefore we must have a COMMA after new_handler
    new_handler, = plt.plot(0.5, 0, 'go', ms=10)
    
    # new_handler now contains a Line2D object
    # and the appropriate way to get data from it is therefore:
    xdata, ydata = new_handler.get_data()
    print xdata
    
    # output:
    # [ 0.5]
    

    The answer was hidden in the Line2D API documentation — I hope this helps.

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

Sidebar

Related Questions

I have an event handler that will remove an element from a list of
i have list of rows that user select and i want to delete them,
I have list of files which contain particular patterns, but those files have been
I have List objects which are shown like this: www.mysite.com/lists/123 Where 123 is the
I have been using BinaryFormatter to serialise data to disk but it doesn't seem
I have an AsyncController and a homepage that queries the user's friends list and
I have an activity that populates a list and does some other things from
We have an API that handles event timers. This API says that it uses
There is application that handles text commands. I have a Qt widget that is
I have code that starts a ProgressDialog inside an AsyncTask , it looks like

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.