[Matplotlib-users] pick_event returning wrong indices
Here's a problem that's been driving me nuts, and I finally reduced it to a small self-contained script which can be found at http://gist.github.com/642538. The issue is that the pick_event does not always provide the correct index into the plotted data. In case this script only bugs out on my machine, let me describe the problem. The callback should highlight whatever point is clicked. This happens correctly with no problems when clicking on 9 out of the 10 points in the figure. But clicking the indicated point on the left-hand side (x[9], y[9]) also causes the indicated point on the top right (x[6], y[6]) to be highlighted as well. Frustratingly, it seems that the numbers themselves are important for reproducing this bug! Specifically, x[9]+=0.01 does not "fix" the bug . . . but x[9] += 0.1 makes the callback work correctly (i.e. only the clicked point is highlighted). I'm guessing this is some sort of tolerance issue somewhere, but I can't find it. possibly-relevant info: matplotlib 1.0.0 numpy 1.3.0 Ubuntu 10.04 64bit thanks, -ryan -- Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] show Z data for contour plots
When I create a plot with contourf(X,Y,Z) the X and Y data are displayed in text (as usual) in the lower right-hand corner of the figure window. Is there a way to report the Z data as well? thanks, -Ryan - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [newbie] "live" plots of multiple lines
Chris Withers wrote: >> So, basically make the x axis time instead of numbers. >> I think the problem is actually that the daets are quite long in their >> format. If they were rotated through 90 degress it'd likely be fine. >> How would I do this? > > I'm not sure it is the easiest way, but it works for me: > > for label in ax.xaxis.get_majorticklabels(): > label.set_rotation(+90) To adjust tick labels when using dates, you could also try Figure.autofmt_xdate (I added it to the example code you were using below). Internally it sets the rotation of the xticklabels as described above, but also sets horizontal alignment of the labels and is especially useful if you have multiple subplots. -Ryan from datetime import datetime from time import sleep ion() # interactive mode 'on' fig = figure() ax = fig.add_subplot(111, autoscale_on=True) x, y = [datetime.now()], [0] line = plot(x, y, label="my_data")[0] # get the line-object as the first element # of the tuple returned by plot legend() for i in arange(30): x.append(datetime.now()) # append new values y.append(i**2) line.set_data(x,y)# reset data ax.relim()# reset axes limits ax.autoscale_view() # rescale axes fig.autofmt_xdate() # adjust the xtick labels draw()# redraw current figure sleep(0.3)# wait 0.3 seconds ioff() show() - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dynamic_collections.py example not working in SVN?
I got the example working (svn diff below). Should Collection objects have a set_offsets method? -Ryan Index: dynamic_collection.py === --- dynamic_collection.py (revision 5020) +++ dynamic_collection.py (working copy) @@ -34,6 +34,8 @@ color = cm.jet(rand()) offsets.append((x,y)) facecolors.append(color) +collection._offsets = offsets +collection.set_facecolors(facecolors) fig.canvas.draw() elif event.key=='d': N = len(offsets) @@ -41,6 +43,8 @@ ind = random.randint(0,N-1) offsets.pop(ind) facecolors.pop(ind) +collection._offsets = offsets +collection.set_facecolors(facecolors) fig.canvas.draw() fig.canvas.mpl_connect('key_press_event', onpress) > Hi, > I tried to run the dynamic_collections.py example in the source > directory (SVN revision 5002) but got the following error: > > Traceback (most recent call last): > File "dynamic_collection.py", line 23, in > transOffset = ax.transData, > TypeError: __init__() got multiple values for keyword argument 'numsides' > > I removed the numsides=5 keyword argument (line 16) from > dynamic_collections.py, and while it lets the example run without error, > the "dynamic" aspect doesn't work. That is, the initial plot with a > single point appears but pressing 'a' or 'd' does nothing (when it > should add or delete a point). > > Any ideas on how to get this working? > > thanks, > -Ryan - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] dynamic_collections.py example not working in SVN?
Hi, I tried to run the dynamic_collections.py example in the source directory (SVN revision 5002) but got the following error: Traceback (most recent call last): File "dynamic_collection.py", line 23, in transOffset = ax.transData, TypeError: __init__() got multiple values for keyword argument 'numsides' I removed the numsides=5 keyword argument (line 16) from dynamic_collections.py, and while it lets the example run without error, the "dynamic" aspect doesn't work. That is, the initial plot with a single point appears but pressing 'a' or 'd' does nothing (when it should add or delete a point). Any ideas on how to get this working? thanks, -Ryan - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users