what is line._invalid in matplotlib 1.0?

Hello. I upgraded from about mpl 0.98.5 to 1.0, and this code, which worked in 0.98.5:

if line._invalid:
    line.recache()

now gives this error:

AttributeError: ‘Line2D’ object has no attribute ‘_invalid’

What is now (1.0) the right way to test whether a Line2D object is invalid?

Thanks very much,

Che

(This question is in another recent post of mine, but this is much more to the point)

Here is a modified version of the code. Note that since it uses
non-public APIs, it may stop to work again in the future. According to
your original post, you seem to want to pick up points only. I guess
the better way is to have a separate artists. One for points and the
other for line segments.

Regards,

-JJ

def contains_points(self, mouseevent):

    pickradius = self.pickradius

    # Make sure we have data to plot
    #if self._invalid:
    if self._invalidy or self._invalidx:
        self.recache()
    if len(self._xy)==0: return False,{}

    # Convert points to pixels
    if self._transformed_path is None:
        self._transform_path()
    path, affine = self._transformed_path.get_transformed_points_and_affine()
    path = affine.transform_path(path)
    xy = path.vertices
    xt = xy[:, 0]
    yt = xy[:, 1]

    pixels = self.figure.dpi/72. * self.pickradius

    d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2
    ind, = np.nonzero(np.less_equal(d, pixels**2))

    # Return the point(s) within radius
    return len(ind)>0,dict(ind=ind)

···

On Mon, Dec 6, 2010 at 8:19 AM, C M <cmpython@...287...> wrote:

Hello. I upgraded from about mpl 0.98.5 to 1.0, and this code, which worked
in 0.98.5:

if line\.\_invalid:
    line\.recache\(\)

now gives this error:

AttributeError: 'Line2D' object has no attribute '_invalid'

What is now (1.0) the right way to test whether a Line2D object is invalid?

Thanks very much,
Che

(This question is in another recent post of mine, but this is much more to
the point)

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

JJ, Thank you very much. This is good to know. However, I had hoped that getting this check of the line’s validity would clear up the main problem I’ve had since going to 1.0–but it did not, The problem is:

Prior to upgrade, I could get picking on a) the legend, and b) all points on the graph, whether the graph had one y axis or two (using twinx).

Now, after upgrade, if I only have one y axis, I can get fine point picking and legend picking, but if I have two y axes, I can’t get legend picking and can only get point picking on the points that belong to the left y axis, not the right y axis.

I get no errors, but no (full) point picking, either. I need to get this cleared up and I’d love to stay with 1.0, but I don’t know what the issue might be.

Che

···

On Sun, Dec 5, 2010 at 9:33 PM, Jae-Joon Lee <lee.j.joon@…287…> wrote:

Here is a modified version of the code. Note that since it uses

non-public APIs, it may stop to work again in the future. According to

your original post, you seem to want to pick up points only. I guess

the better way is to have a separate artists. One for points and the

other for line segments.