[Matplotlib-users] 3d plotting question
Hi, I'm having problems plotting two different kind of graphs on the same 3D figure. Was hoping for some pointers. Here's some basic test code, to demonstrate what I'd like to be able to do. import copy import pylab as P import matplotlib.axes3d as P3 def test() : [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7)) Z = copy.deepcopy(X) Z1 = copy.deepcopy(X) for i in xrange(len(X)) : for j in xrange(len(X[0])) : Z[i][j] = X[i][j]*Y[i][j] Z1[i][j] = X[i][j]*Y[i][j] - 5 P.close('all') fig = P.figure() ax = P3.Axes3D(fig) ax.scatter3D(P.ravel(X),P.ravel(Y),P.ravel(Z)) ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z=x*y') P.show() ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1)) P.show() Which produces an autoscale_view kwarg error appended below. I've tried calling plot3D with scalex=False and scaleY=False but that doesn't fix the problem. I've also tried creating a new axis (e.g. ax1) and doing ax1.Plot3D to no avail. It seems to be an error w/in matplotlib, but perhaps I'm misusing something. I haven't been able to find much documentation for this at http://www.scipy.org/Cookbook/ Matplotlib/mplot3D so have resorted to playing around. If anyone also knows how to pass color-marker info into scatter3D, I have been able to create two of those on the same figure, so being able to change the colors of each and just using scatter3D would be a reasonable hack for my situation. Advice always appreciated, --b In [25]: T.test() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ ipython console /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ threeD.py in test() 18 ax.set_zlabel('z=x*y') 19 P.show() --- 20 ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1)) 21 P.show() 22 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in plot3D(self, xs, ys, zs, *args, **kwargs) 488 def plot3D(self, xs, ys, zs, *args, **kwargs): 489 had_data = self.has_data() -- 490 lines = Axes.plot(self, xs,ys, *args, **kwargs) 491 if len(lines)==1: 492 line = lines[0] /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in plot(self, *args, **kwargs) 2129 lines = [line for line in lines] # consume the generator 2130 - 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines 2133 TypeError: autoscale_view() got an unexpected keyword argument 'scalex' /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes.py(2131)plot() 2130 - 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting question
I also seem to have some other 3D plotting problems. Again, following some of the demo/test advice in the cookbook, I tried things like import pylab as p import matplotlib.axes3d as P3 P3.test_surface() and get errors (seems Axes3D needs a figure, no?). I'm using matplotlib version 0.87.7. Any ideas? Thx, --b In [49]: P3.test_surface() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ ipython console /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in test_surface() 739 740 def test_surface(): -- 741 ax = Axes3D() 742 743 X,Y,Z = get_test_data(0.05) TypeError: __init__() takes at least 2 arguments (1 given) /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(741)test_surface() 740 def test_surface(): -- 741 ax = Axes3D() 742 ipdb In [50]: P3.test_surface? Type: function Base Class: type 'function' String Form:function test_surface at 0x304a070 Namespace: Interactive File: /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/axes3d.py Definition: P3.test_surface() Docstring: no docstring In [51]: P3.test_surface() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ ipython console /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in test_surface() 739 740 def test_surface(): -- 741 ax = Axes3D() 742 743 X,Y,Z = get_test_data(0.05) TypeError: __init__() takes at least 2 arguments (1 given) /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(741)test_surface() 740 def test_surface(): -- 741 ax = Axes3D() 742 ipdb In [52]: P3.test_contour() --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ ipython console /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in test_contour() 750 751 def test_contour(): -- 752 ax = Axes3D() 753 754 X,Y,Z = get_test_data(0.05) TypeError: __init__() takes at least 2 arguments (1 given) /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(752)test_contour() 751 def test_contour(): -- 752 ax = Axes3D() 753 ipdb - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3D curve and errors in axes3d
Hi, I'm replying to this older thread http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ msg02100.html because it relates very much to my recent problem, posted at http:// www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ msg03037.html. This problem seems more general than just the two circumstances you mentioned. I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.: import copy import pylab as P import matplotlib.axes3d as P3 fig = P.figure() ax = P3.Axes3D(fig) ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z)) # this command will fail with the errors identical to those you report. I modified matplotlib's axis.py in a similar way as your suggestion. Line 2131 went from: self.autoscale_view(scalex=scalex,scaley=scaley) to: self.autoscale_view() #scalex=scalex,scaley=scaley) It took me a while to verify that this fixed the problem b/c I didn't at first realize I'd have to kill ipython and restart it (so that it sees the new axes.py file). I wonder what this change to axes.py will break. Any ideas? Thx, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3D plotting lines / markers / colors question
Hi, What kwargs are available for plot3D and scatter3D? Thanks, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3D curve and errors in axes3d
On Apr 11, 2007, at 4:47 PM, belinda thom wrote: Hi, I'm replying to this older thread http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ msg02100.html because it relates very much to my recent problem, posted at http:// www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ msg03037.html. This problem seems more general than just the two circumstances you mentioned. I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.: FYI: It also is a problem when using plot3d --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting question
Thanks for the input. Its easy for me to patch my own machine, but for students in my class who are using lab machines, its more difficult. Hopefully I can get someone to upgrade the machines in the lab I'm using. (Its difficult to get facilities people to agree to update coursework installs mid- semester). Morale of my story: don't expect 3d plotting to necessarily work / be easy if you don't carefully test it first :-(. I too would be interested in robustifying / making more accessible the 3d stuff, but will have to wait until after the class I'm teaching ends. --b On Apr 11, 2007, at 6:57 PM, Tim Leslie wrote: Even in the lastest svn version these test methods are all broken to a greater or lesser degree (as I found out a couple of days ago). If I find time over the weekend I'll try to fix them up. In the mean time, if you change them to look something like fig = pylab.figure() ax = Axes3d(fig) ... etc it should get you one step closer to having them working. I'll post back here if/when I manage to get them cleaned up. Cheers, Tim - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3d plotting question
Hi Belinda, I've been playing with 3D plots and scatter plots in the past few days and I've been able to get them working. You should be able to pass in a c=color parameter as you would for a normal 2d scatter plot. I've been doing this and it's working for me. Interesting. I'm on Mac OS X 4.8.9, running Python 2.4.4, using Matplotlib 0.87.7 w/TkAgg (I might be using Wx, but would have to get a problem w/my machine's and all the students' lab machines wx libraries updated). When I try using the c='r' parameter, I run into problems. I also tried c='red'. One big problem for me is that which kwargs can be used where and what values they can take on is not well documented. For instance, in plot3d (as opposed to plot3D) you can pass the typical Matplotlib 'r.-' string and it just works. But in plot_wireframe, for example, it appears you must use different kwargs (for instance, linestyle='solid' and color='some RGB value'). I am not sure about these notions, b/c I've had to deduce them from the code and various google-based snippets. That's why I'm asking for more guidance about the various kwarg usages. Is there any good place to find more cohesive info online? The most useful place I could find seemed to be in matplotlib's collections.py, an __init__ function's documentation (that's where I deduced, for instance, the linestyle and RGB color info). If there isn't such a place, someone should probably modify the matplotlib 3d cookbook. I'd be willing to do that but I'd first need to have a better understanding about the various functions' kwargs :-). I'll append a case I used to generate an error, as well as the error reporting below. I'm also not quite sure how to use the errors that are reported to help me track down where the problems might be, so if anyone has some advice on that, it might help me better help myself in the future. As always, thx, --b Example Code: - import copy import pylab as P import matplotlib.axes3d as P3 def test() : [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7)) Z = copy.deepcopy(X) Z1 = copy.deepcopy(X) for i in xrange(len(X)) : for j in xrange(len(X[0])) : Z[i][j] = X[i][j]*Y[i][j] Z1[i][j] = X[i][j]*Y[i][j] - 5 P.close('all') fig = P.figure() ax = P3.Axes3D(fig) ax.Plot3D(ravel(X),ravel(Y),ravel(Z),c='r') In [213]: T.test() --- exceptions.AttributeErrorTraceback (most recent call last) /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ ipython console /Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ threeDa.py in test() 11 Z1[i][j] = X[i][j]*Y[i][j] - 5 12 P.close('all') 13 fig = P.figure() 14 ax = P3.Axes3D(fig) --- 15 ax.Plot3D(ravel(X),ravel(Y),ravel(Z),c='red') /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes3d.py in __getattr__(self, k) 660 661 def __getattr__(self, k): -- 662 return getattr(self.wrapped,k) 663 664 def __setattr__(self, k,v): AttributeError: Axes3DI instance has no attribute 'Plot3D' /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes3d.py(662)__getattr__() 661 def __getattr__(self, k): -- 662 return getattr(self.wrapped,k) 663 ipdb - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: 3d plotting question
Forwarding this to the list I'm curious if you run into another problem I recently reported. Can you do, e.g.: import copy import pylab as P import matplotlib.axes3d as P3 def test() : [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7)) Z = copy.deepcopy(X) Z1 = copy.deepcopy(X) for i in xrange(len(X)) : for j in xrange(len(X[0])) : Z[i][j] = X[i][j]*Y[i][j] Z1[i][j] = X[i][j]*Y[i][j] - 5 P.close('all') fig = P.figure() ax = P3.Axes3D(fig) ax.plot3d(ravel(X),ravel(Y),ravel(Z),'r.-') or do you instead get an error in matplotlib's axes.py, complaining about self.autoscale_view and a scalex parameter? For more on the hack I made to axes.py file which then allowed me to use plot3d, see http://www.mail-archive.com/[EMAIL PROTECTED]/ msg03041.html. Thanks for providing more info. --b Begin forwarded message: From: Richard Brown [EMAIL PROTECTED] Date: April 11, 2007 8:41:37 PM PDT To: belinda thom [EMAIL PROTECTED] Subject: Re: [Matplotlib-users] 3d plotting question On 12/04/07, belinda thom [EMAIL PROTECTED] wrote: I also seem to have some other 3D plotting problems. Again, following some of the demo/test advice in the cookbook, I tried things like import pylab as p import matplotlib.axes3d as P3 P3.test_surface() I too just encountered the same problem - what is the last version of mpl for which doing this worked? (I'm using 0.9 revision 3131) -- Richard Brown Ph.D. Candidate Dept. of Mechanical Engineering University of Canterbury, NZ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 3D curve and errors in axes3d
Thanks Eric! I'm kind of afraid to upgrade to the SVN version b/c I fear something else might break (I've yet to install matplotlib from source b/c of a few nagging Mac OS X issues). What would you recommend? There's also the issue of having to upgrade student machines for which I'm not admin. Grrr. --b On Apr 11, 2007, at 6:19 PM, Eric Firing wrote: Belinda, John has checked in some fixes for axes3d recently, and your test code now runs with the version in svn--except for the problem that you should use P.show() only once in a given script. (I think there is some backend for which you can get away with using it more than once, but this is not good practice.) Eric belinda thom wrote: On Apr 11, 2007, at 4:47 PM, belinda thom wrote: Hi, I'm replying to this older thread http://www.mail-archive.com/matplotlib- [EMAIL PROTECTED]/ msg02100.html because it relates very much to my recent problem, posted at http:// www.mail-archive.com/matplotlib- [EMAIL PROTECTED]/ msg03037.html. This problem seems more general than just the two circumstances you mentioned. I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.: FYI: It also is a problem when using plot3d --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php? page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] passing mouse clicks back to a polling application
Thanks everyone for the advice. For anyone in my boat following this thread, here's what I ended up doing: Had a stroke of insight and coded the whole thing up (poorly) using maptlotlib w/no polling. In other words, the entire API sat in the mouse click callback function. Lame, yes---especially since some expensive AI search can be going on that takes more than a few seconds---but as long as my students take care not to enter more than one mouse click before each screen update, the app doesn't seem to suffer from inconsistency problems. Its pretty darn nice looking w/ matplotlib, too. So, that's the band aid. I'm sad to hear that its not as easy to use matplotlib to write more sophisticated apps than it is w/matlab but am glad that it is documented here. To summarize what I gleaned from Chris, the maptlotlib (interactive?) thread doesn't handle anything but its own stuff (e.g. mouse callbacks) directly, so my attempt to use the threading event/wait stuff failed for that reason (?). The pyrobotics app would be a good candidate for using matplotlib, but might not be easy to use for similar reasons. I am wondering if a socket-based approach, where matplotlib served up, for instance, mouse clicks, plots, etc, to a client app might be a good compromise. I am still unclear how John's recs for timer or idler (which I've been able to find no accessible documentation on) would have helped me. For instance, wouldn't the timer rec fail for the same reason my event wait thread hack did? Being sad, however, I understand that the main focus of matplotlib is high- and scientific-quality graphics, for which it seems to hit the nail on the head. Francisco's rec to the for non-programmers programming a GUI document looks very worthwhile (and I am a seasoned programmer). I intend to have a serious look at it this summer, b/c I intend to write a more serious app using Python that needs a GUI (an audio file viewer and editor to be used for my music perception research). The document does indeed seem like a good introduction to event-based programming, and had I a week or more to spare, would probably have tried using the related packages to build the app. Before the stroke-of-insight, I got lucky and managed to get a simple Tk app working that handled displaying the game and processing mouse clicks, but I foiled in my attempts to capture keyboard input, so after several hours gave up. It does seem wx is more suited for OS X, and my brief googling seems to imply that Tk is becoming the thing people---esp on OS X---USED to use. I've heard that Apple's own InterfaceBuilder is THE WAY to program GUI-based apps and wonder if anyone has had experience using this w/Python? Thanks again for the advice. A last question for Chris... If it does look promising, be sure to get the latest version from: http://www.mithis.com/~chrisb I never found the time to finish my matplotlib-scipy install from source (b/c of the apple's wx incompatibility), but I do intend to finish with that business when I return in June and am wondering if your above rec about a wx latest-version would interfere with that? --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] passing mouse clicks back to a polling application
On Apr 5, 2007, at 6:27 AM, John Hunter wrote: On 4/5/07, belinda thom [EMAIL PROTECTED] wrote: My app needs to look something like this: -- create a game and display it in a matplotlib figure while game not over : if its player 1's turn, get player 1's valid mouse input, otherwise get player 2's You need to get out of the mold of thinking about while loops with blocking input. Instead make everything event driven and track state variables to decide which player's mouse events to process. So instead of getting a blocking input, simply do nothing on events unless you are in a certain state. You can use a timer or an idle handler for recurring processing rather than a while loop. This was the kind of advice I was looking for. Being so new to Python, I hadn't a clue what to look for. I do think its valuable to be able to write a blocking mouse function. After your pointer to Timer (which led me to the threading Python library) and idle handler (which I didn't find useful doc on, so didn't persue), I came up with the code I'll append below. My printing of time elapsed seems to imply the thing is working as I'd expect (I see times that differ by about 1 second). Problem is, I still get the twirling wheel of deadness on my Mac that led me to post my original message. And then I got Chris's great reply, which makes me wonder if I'm trying to do too much. I've been using pyrorobotics, which relies heavily on Tk, but their plotting facilities are not great. So I started using matplotlib and really like it. And I ran into problems w/their Tk interface where windows wouldn't update correctly on the mouse unless the mouse was clicked in the window. Found some stuff via google implying this was some nasty bug on Mac, didn't find an easy work around, so now try to use matplotlib whenever possible, which explains my current path to trying to use it to provide a simple graphic interface to a python Connect 4 game that I wrote so my students can have fun writing smart game players in my AI course. In Matlab, I'm used to building applications, so I was hoping it would be possible to do something similar in matplotlib. Perhaps matplotlib is not currently set up for such things (in which case I'd like to ask if this is something you'd like to include in the future). Thanks again, --b class Mouse : def __init__(self,f,cb) : self.data = None self.cb = cb def getClick(event) : self.data = event.xdata self.cb() f.canvas.mpl_connect(button_press_event,getClick) def blockMouse(f,rng) : import threading import time startTime = time.time() e = threading.Event() def cb() : e.set() m = Mouse(f,cb) def valid(val,rng) : print time elapsed is %g % (time.time()-startTime) if val == None : return False for i in rng : if i-.4 = val = i+.4 : return True return False # poll til valid while True : e.wait(1) if valid(m.data,rng) : break else: e.clear() m.data = None return m.data def app() : import pylab pylab.close('all') f = pylab.figure() rng = [1,2,3] pylab.plot([1,2,3],[1,2,3]) pylab.axis([0,4,0,4]) while True : mouse = blockMouse(f, rng) if mouse == 2 : break else : print mouse - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] passing mouse clicks back to a polling application
On Apr 5, 2007, at 1:20 PM, Ken McIvor wrote: On Apr 5, 2007, at 2:14 PM, belinda thom wrote: I do think its valuable to be able to write a blocking mouse function. After your pointer to Timer (which led me to the threading Python library) and idle handler (which I didn't find useful doc on, so didn't persue), I came up with the code I'll append below. My printing of time elapsed seems to imply the thing is working as I'd expect (I see times that differ by about 1 second). Problem is, I still get the twirling wheel of deadness on my Mac that led me to post my original message. You will probably always have this problem when you do things that prevent the GUI's event loop from running. Hmmm. Makes sense. I'll include a tidbit from Chris that I received via personal email b/c it relates: -- Thinking about your issue a bit -- the problem here is that MPL does not provide an event loop. In Matlab, the command line and figure windows share an event loop. In MPL, the event loop is provided by the hosting GUI toolkit, and is separate from command line event loop. For that reason, MPL itself is a bit divorced from the process. That why Ken and I have suggested that you'd be better off embedding MPL in a gui toolkit, if it's just the kind of plotting you need, or using another drawing widget in a GUI toolkit if you really need non- plotting type drawing. If it hadn't been for the bugs, TK probably would have been a fine option for you. - Are you running your code from within iPython or as a script? And then I got Chris's great reply, which makes me wonder if I'm trying to do too much. I'd have to agree with Chris that you are trying to do too much from within pylab. Darn. I am writing this reply as a desperate attempt to make sure there's not some quick fix to make it work in my specific case; I'm about ready to give up or try something like Tk, but am running out of time. We might, alas, have to settle for a command-line based game :-(. So, how do the above observations relate to John Hunter's recommendation that I use a timer or idler? It was the reply from him that led me to think I might be able to come up w/something that worked w/o too much dorking. I've been using pyrorobotics, which relies heavily on Tk, but their plotting facilities are not great. So I started using matplotlib and really like it. And I ran into problems w/their Tk interface where windows wouldn't update correctly on the mouse unless the mouse was clicked in the window. Found some stuff via google implying this was some nasty bug on Mac, didn't find an easy work around, so now try to use matplotlib whenever possible, which explains my current path to trying to use it to provide a simple graphic interface to a python Connect 4 game that I wrote so my students can have fun writing smart game players in my AI course. If that's what you're aiming for you'd probably be happier with the result if you write something using Tkinter's Canvas or the wxPython FloatCanvas. Understood. If I could get something working really quickly, I might go that route. But it would have to take a few hours tops, and that would include me figuring out how to get in mouse clicks and draw graphics. In Matlab, I'm used to building applications, so I was hoping it would be possible to do something similar in matplotlib. Well, it's entirely possible to build applications that use matplotlib. The thing to remember is that matplotlib isn't its own programming language or development environment -- it ties Python and and bunch of libraries together to provide a Matlab-like interface in the 'pylab' module. Fair enough. Thanks for the valuable observation. Perhaps matplotlib is not currently set up for such things (in which case I'd like to ask if this is something you'd like to include in the future). Although I'm matplotlib is going to continue becoming more powerful and flexible, I'd personally be surprised if that ever becomes one of the project's goals. I obviously can't speak for anyone else, but it seems to me that people who want to build GUI applications using matplotlib should be doing so by using matplotlib from within Python. I also suspect that the engineering effort involved in making this functionality happen might be beyond the scope of the project. Ditto. Thx, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] reversing an axis
Hi, I'm wondering if there's an easy way to reverse an axis in a plot. For instance, suppose I wanted to create a plot that had its origin in the upper left hand corner, so that x would range from, say 0 to 1 moving right, and y would range from, say 0 to 1, moving down. Thanks! --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] passing mouse clicks back to a polling application
Hi, I'm trying to write a very simple GUI using matplotlib and have gotten stuck. Hopefully someone out there has done something similar and can point me on my way. First, I should mention that the examples provided with matplotlib weren't immediately helpful to me, because when I try to run various demos (like pick_event_demo or object_picker) it fails b/c I'm relying on (and have to rely on) TkAgg. Sadly, I'm too new to understand what I would need to do to get those demos working. So I found someone processing mouseclicks using a Mac online and started there. I ended up with something like this: from pylab import * class gui : def __init__(self) : self.f = figure() self.data = None # valid mouse click hasn't yet happened def clicker(event): self.data = event.xdata self.f.canvas.mpl_connect(button_press_event,clicker) def getNextValidClick(self) : (data, self.data) = (None, None) while True : print Waiting for valid mouse click... while self.data == None : pass # keep polling if 1 = self.data = 3 : # consider this a valid next mouse click (data, self.data) = (self.data, None) break return data With which I tried: g = gui() x = g.getNextValidClick() but the latter line caused me to experience the spinning wheel of dead that we mac users so enjoy. I have the feeling I need to explicitly yield or some such in the poll loop, but I don't know how to do that. Advice greatly appreciated, both on the code I've provided, and on if there is a better way altogether to provide an app with data obtained via a matplotlib mouse click callback. Thanks, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installing numpy, matplotlib, scipy from source on a Mac
PPS: Belinda, now that you've done all this work, I do hope you can go the extra mile and figure out how to make a binary package of it all for others! I certainly would like to to do this, but its gonna have to wait until after TheCurrentCrisis alleviates. Hopefully before Feb (in the worst case, mid-June), as I too am annoyed at how hard this seemed to be for the Mac. I also find it disconcerting that Vincent had different troubles than I w/the same source instructions (did they ever get resolved)? As had Erin. At the same time, until about May I'll have access to both Intel and PPC Macs, so I have an ideal env. on which to test. I have only a vague idea how to make dmgs (have perused the incomprehensible hdutils man page), though, so may need some help. At the same time, I'm not qualified to fix the Vincent/Erin problems and have no idea how to go about making universals that work for everyone. In fact, these current threads lead me to wonder if it can actually be done (the sad alternative is this: anyone w/a Mac that wants to use the matscinum suite [defined below], unless you have piles of time to waste, stick w/matlab provided you can afford it). W/all this talk about numpy integrating w/python (via a PEP), it seems the best customers for such a move would be a unified matscinum community. Right now that community (at least on the Mac) is accessible to the uber-gang only (of which I barely pass the bar, but since I've gotten SOMETHING working, w/much online help, I feel I've earned the right to include myself). I should mention a friend of mine who knows a lot more about sys stuff than I do had a heck of a time getting all this running on Linux---the entire package: matplotlib, numpy, scipy---lets call it the matscinum suite. In fact, it really seems this integration/ installation issue should be addressed across these 3 respective mailing lists, for if one doesn't work, the others become unusable for on non-trivial number of people (Perhaps there should be a list that is a combo of these three?) FWIW, this is just hot off the macpython sig list: - Is it that hard to make a binary to put up (OK, two - one for PPC, one for Intel), once you've gotten it all built? At least a few people have gotten it going recently. Could someone please make them available? How about posting them on your own Web site then? If you don't have one, the price of commodity Web hosting is virtually zero, and there are plenty of free open source project hosting services around, some of them even good. It's been repeatedly stated on this mailing list that the currently pythonmac.org maintainer doesn't have time, and would be happy to relinquish control to someone who did. But nobody's volunteered. It is really rather tiresome to read about people asking for someone to do something when everyone's doing this work for free. - I agree with the sentiments but also recognize that the documentation at scipy (where most of this stuff is loaded) is inaccurate, e.g. the superpak doesn't work. Well, that's it for now. I'll try your wx rec's as soon as I find the time (likely next week). Gotta run and thanks for all the help, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [Pythonmac-SIG] Compiling Scipy/available binaries for Universal Python 2.4?
FWIW On Jan 11, 2007, at 5:29 PM, Bob Ippolito wrote: On 1/11/07, Nicholas Riley [EMAIL PROTECTED] wrote: On Thu, Jan 11, 2007 at 02:21:19PM -0800, Christopher Barker wrote: Is it that hard to make a binary to put up (OK, two - one for PPC, one for Intel), once you've gotten it all built? At least a few people have gotten it going recently. Could someone please make them available? How about posting them on your own Web site then? If you don't have one, the price of commodity Web hosting is virtually zero, and there are plenty of free open source project hosting services around, some of them even good. It's been repeatedly stated on this mailing list that the currently pythonmac.org maintainer doesn't have time, and would be happy to relinquish control to someone who did. But nobody's volunteered. It is really rather tiresome to read about people asking for someone to do something when everyone's doing this work for free. Well I'm back in the country now and I just got my mbp back from applecare today... so if someone sends me updated binaries I'll gladly sync them to pythonmac.org. -bob - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] clearing a figure
Hi, With the exception of ipython -pylab, noone is forcing you to import *. And on the subject, Fernando, perhaps we should support a pylab mode in ipython which doesn't dump the pylab namespace (or maybe just dumps the required figure, show, close, nx), but does the interactive backend stuff. In the meantime, I did the following to my local dev copy of IPython: Instead of the existing import... viq exec into user namespace, I do: import pylab as P import numpy as N import matplotlib as M It would be nice if controlling this type of thing was configurable. --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] idle and ipython and axis
Mark, BTW, when you use pylab in interactive mode, the axis() command should scale your figure interactively, also under IDLE. Have you tried that? Yes, I tried using axis in both IDLE and IPython. IPython's redrew the axis automatically whereas IDLE's did not. I am not sure, but I think this difference in behavior is b/c IPython is a bit better about calling draw_if_interactive after most pylab functions (see Eric Firing's http://www.mail-archive.com/matplotlib- [EMAIL PROTECTED]/msg02037.html) than IDLE is. I have experienced the same problem with IDLE. It only works with -n, but then you lose the nice feature of 'starting over'. Does anybody know a fix so we can do both? I too would LOVE to have the ability to start over as IDLE w/o the -n allows. Unfortunately for me (on a Mac) I've not yet been unable to use WxAgg w/matplotlib using Mac-available packages. I might be able to use it after I'm done following http://projects.scipy.org/ pipermail/numpy-discussion/2007-January/025368.html, but I'm in crunch-mode at the moment, so that install is going slowly. --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installing numpy, matplotlib, scipy from source on a Mac
I am posting this message to both numpy and matplotlib mailing lists because the thread relates to both. First, Robert Kern kindly provided step-by-step instructions for Macs (PPCs and Intels) regarding how to install FROM SOURCE the packages needed to allow Python to become a viable alternative for Matlab. Details regarding the installation of matplotlib (along with wx, which is supposed to allow the WxAgg backend to work), numpy, and scipy were provided. The reason for installing FROM SOURCE on a Mac is because various packages need to be compiled in such a way that they rely on the same underling shared libraries, etc. for things to work (I've described some problems w/installing from numpy, scipy, and matplotlib dmgs at http://www.mail-archive.com/ numpy-discussion at scipy.org/ msg00481.html). From these instructions, I've been able to acheive numpy.test() anad scipy.test() that run w/no failures -- hooray! However, after installing wx and matplotlib, various problems result: 1) warnings about fonts 2) wx fails to work I've appended the warnings below. These only occur the first time pylab is imported (does this make sense?). After that, I've appended the issues I've had when trying to use wx as a backend. One reason I'd like to be able to use wx is that it appears with TkAgg, running IDLE (w/the -n flag) can hang (see: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/ msg02039.html). Point that originally confused me: although wx is needed for the WxAgg backend, you don't need to install the analogous Tk package to use TkAgg PROVIDED you're using MacPython, for that comes bundled w/ an Aqua-based Tk interface. I'm on a G4 PPC, w/OS X 10.4.8, and using MacPython 2.4. Any idea what wx doesn't work? Thanks, --b ONE-TIME WARNINGS: Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type help, copyright, credits or license for more information. history mechanism set up import pylab as P /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/font_manager.py:455: UserWarning: Could not open font file /Library/Fonts/NISC18030.ttf warnings.warn(Could not open font file %s%fpath) snip /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/font_manager.py:455: UserWarning: Could not open font file /System/Library/Fonts/TimesLTMM warnings.warn(Could not open font file %s%fpath) WX / MATPLOTLIB FAILURE -- 4 % python Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type help, copyright, credits or license for more information. history mechanism set up import matplotlib as M import pylab as P M.rcParams['interactive'] True M.rcParams['backend'] 'WXAgg' P.plot([1,2,3]) Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/backends/backend_wx.py, line 1048, in _onPaint self.draw(repaint=False) snip figManager.canvas.draw() File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/backends/backend_wxagg.py, line 63, in draw self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None) MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] clearing a figure
Hello, I'm a new matplotlib user, coming from the Matlab end. Is there a standard way to create a figure (here I'd like the equivalent of matlab's hold on, so I can draw multiple things) and then clear the figure (so the drawing goes away) so I can repeat the process again? The commands to plot that I'll be using are fairly simple line commands. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] clearing a figure
One of the reasons I'm confused is b/c when I poked around, I found a clear method: help(pylab.gcf().clear) Help on method clear in module matplotlib.figure: clear(self) method of matplotlib.figure.Figure instance Clear the figure but when I execute this on my open figure: pylab.gcf().clear() nothing happens; the figure's still displaying whatever was already on it. So far, the only thing I've found that works is to call plot differently when its time to clear the figure (pass hold=False). Subsequent calls to plot (w/o this option) keep adding to, which is great. Is passing a hold=False arg to a drawing command the preferred way to clear a figure, or is clear() not working properly? Many thanks, --b On Jan 9, 2007, at 7:50 PM, belinda thom wrote: Hello, I'm a new matplotlib user, coming from the Matlab end. Is there a standard way to create a figure (here I'd like the equivalent of matlab's hold on, so I can draw multiple things) and then clear the figure (so the drawing goes away) so I can repeat the process again? The commands to plot that I'll be using are fairly simple line commands. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] idle and ipython and axis
Hi, I've been playing w/both IDLE and IPython, using TkAgg in both cases as the back end. Also, I've got the latest matplotlib and ipython versions and am using MacPython's 2.4.4 IDLE. It seems that if IDLE is not invoked w/the -n flag, the figures that are drawn can often get the whirling swirl of death (i.e. they hang). Has it been other users' experience that the -n removes that problem (it mentioned this flag in the manual, but I didn't catch he motivation)? And if so, is there no other way to use IDLE when using matplotlib interactively? (The nice thing about IDLE is its fresh state each time you run a file; this goes away when -n is used). I'm pleased to report no whirling wheels when using matplotlib via IPython. By being able to compare behavior on both I might have found a bug: I can create plots to my hearts content in both, but when I ask to rescale the plots, e.g. axis([-.2,2.4,-2,2.4]), NOTHING happens to the figure drawn via IDLE, whereas the command works as expected in IPython. I hope posting this is useful. Feedback welcome. --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] load_demo.py
Hi, The documentation for pylab.load mentions the load_demo.py example. I can't find this on my distribution. I believe all Pylab examples live in site-packages/doc/matplotlib, for in there are files like log_demo.py (the only file that begins with load is load_converter.py, which is demonstrating using dates). Does anyone have access to load_demo.py or does it not exist (in which case the documentation for load should be modified)? Thanks, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] saving data to a file
Hi, Is there a way for me to keep adding the next row of a 2d array to a file via load? (matlab's save had a very useful -append option). I managed to get 2d laod/save working, e.g. import numpy as N import pylab as P import bthom.utils as U # a numpy 2d array a = N.arange(12,dtype=N.float).reshape((3,4)) a[0][0] = N.pi # checking out the matploblib save/load stuff P.save(data.csv, a, fmt=%.4f, delimiter=;) aa = P.load(data.csv, delimiter= ;) x,y,z,w = P.load(data.csv, delimiter=;, unpack=True) The above took me longer than it perhaps should have b/c of advice I'd gotten elsewhere recommending trying to keep numpy and pylab separate when possible (to take advantage of all of numpy's features; it seems numpy doesn't even have the all-to-handy load/save functionality). When I try similar tricks to write one row at a time, I'm hosed in that the shape is gone: # checking out a way to keep appending fname = data1.csv U.clobber_file(fname) #this thing just ensures 0 bytes in file f = open(fname,a) nrows,ncols = a.shape for i in range(nrows) : P.save(f, a[i,:], fmt=%d, delimiter=;) f.close() aaa = P.load(data1.csv, delimiter= ;) in particular: % cat data1.csv 3 1 2 4 snip 11 Thanks in advance, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlibrc numerix Numeric problem
Hi, I'm unable to use matplotlib when I have the following line in my matlabplotrc file: numerix Numeric. There is no problem when I use: numerix numpy Here's my setup: Mac G5 w/OS X 10.4.8, using MacPython 2.4, numpy.__version__ is 1.0, matplotlib.__version__ 0.87.7 and Numeric.__version__ 24.2 I append below the errors I get when trying to use numerix Numeric via python and ipython. Is this a bug? --b VIA IPYTHON: 6 % ipython -pylab Python 2.4.4 (#1, Oct 18 2006, 10:34:39) Type copyright, credits or license for more information. IPython 0.7.2 -- An enhanced Interactive Python. ? - Introduction to IPython's features. %magic - Information about IPython's 'magic' % functions. help- Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: plot([1,2,3]) --- exceptions.TypeError Traceback (most recent call last) /Users/bthom/belinda/mills/aicourse/tic-tac-toe/ipython console /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/pylab.py in plot(*args, **kwargs) 2025 hold(h) 2026 try: - 2027 ret = gca().plot(*args, **kwargs) 2028 draw_if_interactive() 2029 except: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in plot(self, *args, **kwargs) 2129 lines = [line for line in lines] # consume the generator 2130 - 2131 self.autoscale_view(scalex=scalex, scaley=scaley) 2132 return lines 2133 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in autoscale_view(self, tight, scalex, scaley) 983 if xl[1] xl[0]: 984 XL = XL[::-1] -- 985 self.set_xlim(XL) 986 if scaley: 987 yl = self.get_ylim() /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- packages/matplotlib/axes.py in set_xlim(self, xmin, xmax, emit) 1225 xmax += 1e-38 1226 - 1227 self.viewLim.intervalx().set_bounds(xmin, xmax) 1228 if emit: self._send_xlim_event() 1229 return xmin, xmax TypeError: only length-1 arrays can be converted to Python scalars. .pdbrc.py started .pdbrc.py finished /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ site-packages/matplotlib/axes.py(1227)set_xlim() 1226 - 1227 self.viewLim.intervalx().set_bounds(xmin, xmax) 1228 if emit: self._send_xlim_event() VIA PYTHON: = 3 % python Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type help, copyright, credits or license for more information. history mechanism set up import pylab pylab.plot([1,2,3]) Traceback (most recent call last): File stdin, line 1, in ? File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/pylab.py, line 2027, in plot ret = gca().plot(*args, **kwargs) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/axes.py, line 2131, in plot self.autoscale_view(scalex=scalex, scaley=scaley) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/axes.py, line 985, in autoscale_view self.set_xlim(XL) File /Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/matplotlib/axes.py, line 1227, in set_xlim self.viewLim.intervalx().set_bounds(xmin, xmax) TypeError: only length-1 arrays can be converted to Python scalars. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] archives
Hi, The source forge archive for this mailing list: http://sourceforge.net/mailarchive/forum.php? forum_id=33405max_rows=25style=ultimateviewmonth=200612 has no posts listed as of 12/24/06. I've posted several things today and would like to be able to view their progress. Has this archive moved? Thanks, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] two y axes via twinx and legends
Hi, This mailing list is great---I've gotten a couple very useful replies from others in a very short time period. Thanks! And now, onto my next question. I need to construct a two-y-axis plot. I've found some hints on how to do this on the mailing archive (Subject: secondary y-axis, Date: 9/28/05). I've got the basics working, but have run into the same problem this prior post did: I want a legend that lists content from both the left-hand-sided plots and the right-hand-sided ones. It appears only one axis or the others data can appear in a legend. Is there anyway to merge the two axes into a single legend? Also, the mail archives I'm viewing look terrible: line breaks aren't in the usual place, things are presented with 's in them (which would make sense if the line breaks were preserved, b/c they correspond to pieces of prior email content). I'm using Safari 2.0.4 w/Mac OS X 10.4.8. Do others see the same thing, and if the answer is yes, are folks satisfied with this state of affairs? Thanks, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] more outdated/unhelpful documentation and installation issues on Mac OS X 10.4
Note: there is a type-o in the above email. W/MacPorts, I've been able to get the TkAgg backend to work should be W/MacPython, I've been able to get the TkAgg backend to work - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] two y axes via twinx and legends
Looks like I've been able to help myself on this one. I'll post this here b/c others had asked about this in prior emails and I never saw an answer given. You can make your own custom legend by keeping the return values from each plot command: e.g. l1 = plot(y1's stuff) twinx() l2 = plot(y2's stuff) legend([l1,l2],['y1s tag','y2s tag']) works like a charm. HTH --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] more outdated/unhelpful documentation and installation issues on Mac OS X 10.4
Hi again, At http://matplotlib.sourceforge.net/installing.html under topic OS X: All of the backends run on OS X. Chris Barker has built a binary package (fink users see below) for matplotlib which is hosted on pythonmac, and works with Agg, Wx and Tk; see the step-by-step instructions kindly provided by Michael Tobis. note that the step-by-step link leads to: Under revision. Please come back soon. -- It is because I've had some installation troubles that I have been looking at the OS X install info so closely. For instance: originally I tried to use macports for all python site- packages-related installs (as well as using their python24). The ONLY backend that seems to work thru that route is WxAgg (http:// howdy.physics.nyu.edu/index.php/Numpy_For_Mac_Using_MacPython corroborates this). I was able to achieve results w/backend WxAgg and numerix Numeric. However, when I tried to change the toolbar to classic, WxAgg crapped out. W/MacPorts, I've been able to get the TkAgg backend to work, but _NOT_ with numerix set to Numeric. Success was only achieved w/TkAgg when numerix was set to Numpy. When I try the WXAgg backend (along w/ the pythonmac 2.6.3.3 wxPython dmg for python 2.4), a simple plot ([1,2,3]) craps out with: exceptions.MemoryError Traceback (most recent call last) snip --- 63 self.bitmap = _convert_agg_to_wx_bitmap (self.get_renderer(), None) 64 if repaint: 65 self.gui_repaint() snip MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] obtaining version info
Hi, Perhaps I'm missing something really basic, but I can't figure out how to query pylab as to what version it is (the usual import foo, foo.__version doesn't work). Advice appreciated. --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] out-dated documentation
Hello, Regarding http://matplotlib.sourceforge.net/installing.html, there is some unreliable info. In particular, under the OS X topic, Robery Kern has built an all-in-one installer which includes scipy, Numeric, numarray, matplotlib, ipython, VTK, MayaVi, PIL, the enthought tool suite and much more; see MacEnthon. should be removed. Whoever maintains this page should make the appropriate change. On Dec 6, 2006, at 11:38 PM, Robert Kern wrote: belinda thom wrote: I do not want to compile code myself unless absolutely necessary. I was wondering what was up with the MacEnton suite; clicking on the link described at the above web page informs me that the MacEnthon page does not exist. Umm, ignore it. It targetted a now-old Python distribution, and I don't have time to update it anymore. References recommending it should be removed. -- Robert Kern - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] open figures list
Hello, Is there a way to return a list of all the open figure numbers? For instance, if I had: close('all') figure(1) [some plotting] figure(5) [some plotting] I'd like to be able to have access to a command that returns the list [1, 5]. Thanks, --b - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users