[Matplotlib-users] Merge colorbars from imshow and contour
Hi, in a case similar to matplotlib-0.87.7/examples/contour_demo.py (figure 4), would it be possible to merge to two colorbars (a continuous one from imshow, a discrete one from contour) into a single colorbar? Indeed, in that case, the two colorbars are mostly redundant. Cheers. -- / \ ,, _._ _ |oo| _ / \__/ \ _ ((/ () \)) / \ Yannick COPIN (o:* Doctus cum libro |/| ( )|oo| Institut de physique nucleaire de Lyon \/ _`\ /'_/ \(IN2P3 - France) / /.-' /\/\ `\.( () )_._ Tel: (33/0) 472 431 968 |` / \/ \ /`'--') http://snovae.in2p3.fr/ycopin/ \__,-'`| |. |\/ |/\/\|\` AIM: YcCopinICQ: 236931013 jgs | |. | \___/\___/ | |. | || - 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] Different contours in contour and contourf
Hi, running the simple test code: from pylab import * X, Y = meshgrid(linspace(-3,3,11),linspace(-3,3,11)) Z = randn(*X.shape) lev = linspace(Z.min(),Z.max(),11)[1:-1] contourf(X,Y,Z, lev, extend='both') contour(X,Y,Z, lev, colors='k') show() you will probably notice that the 'contourf' contours are not always exactly the sames as the 'contour' contours. Why is it so? Don't contour and contourf use the same contour constructor? Cheers. -- / \ ,, _._ _ |oo| _ / \__/ \ _ ((/ () \)) / \ Yannick COPIN (o:* Doctus cum libro |/| ( )|oo| Institut de physique nucleaire de Lyon \/ _`\ /'_/ \(IN2P3 - France) / /.-' /\/\ `\.( () )_._ Tel: (33/0) 472 431 968 |` / \/ \ /`'--') http://snovae.in2p3.fr/ycopin/ \__,-'`| |. |\/ |/\/\|\` AIM: YcCopinICQ: 236931013 jgs | |. | \___/\___/ | |. | || - 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] giving parameters to func when using events
Hello everyone, below is a little code - what it actually does is quite self-explanatory. (When clicking with left - draw a red circle. When the right button is pressed switch to a different mode. Now green squares are drawn and so on.) My question now is: Is there a way to avoid using global variables but also avoid an object-oriented programming? In other words: Is it possible to pass e.g. a dictionary containing some information to the function called by the event? The reason for not wanting the object-oriented way is: We want to teach something to students who never programmed before. And to them it would be pretty hard if we start everything object-oriented! Thanks for your suggestions, Martin from pylab import * def two_parts(event): global program_part if event.button == 3: program_part = program_part%2 + 1 print Changed to part to , program_part if program_part == 1 and event.button == 1: plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r') if program_part == 2 and event.button == 1: plot([event.xdata], [event.ydata], marker = 's', mfc = 'g') draw() figure(1) ax = subplot(111, autoscale_on=False) ax.set_xlim([0,1]) ax.set_ylim([0,1]) program_part = 1 print Actual program part is , program_part connect('button_press_event', two_parts) show() - 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] giving parameters to func when using events
Martin == Martin Richter [EMAIL PROTECTED] writes: Martin My question now is: Is there a way to avoid using global Martin variables but also avoid an object-oriented programming? Martin In other words: Is it possible to pass e.g. a dictionary Martin containing some information to the function called by the Martin event? The reason for not wanting the object-oriented way Martin is: We want to teach something to students who never Martin programmed before. And to them it would be pretty hard if Martin we start everything object-oriented! The can use attrs on the function def two_parts(event): if event.button == 3: two_parts.program_part = two_parts.program_part%2 + 1 print Changed to part to , program_part if two_parts.program_part == 1 and event.button == 1: plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r') if two_parts.program_part == 2 and event.button == 1: plot([event.xdata], [event.ydata], marker = 's', mfc = 'g') draw() two_parts.program_part = 1 which would introduce them to attributes and pave the way to thinking about OO. JDH - 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] clip_on bug? and 2nd-axis label question
In past work I have not been able to get clipping to behave as I expected. Today I was trying to understand how to add a right-axis label and was using an example from the matplotlib site that set clip_on=False. It did not work. In looking at the code in method text() it appears that it checks for the existance of clip_on and not the value. So clip_on=False results in clipping but not specifying clip_on does not. Is this understanding correct and is it the intended behavior? If so, I can't see how the example could have worked. Also is there a standard, easy way to get a 2nd (right) axis label and ticks or does it have to be done manually? I found only the one example on the screenshots page where it is done with several text() method calls. -- David - 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] Different contours in contour and contourf
Yannick Copin wrote: Hi, running the simple test code: from pylab import * X, Y = meshgrid(linspace(-3,3,11),linspace(-3,3,11)) Z = randn(*X.shape) lev = linspace(Z.min(),Z.max(),11)[1:-1] contourf(X,Y,Z, lev, extend='both') contour(X,Y,Z, lev, colors='k') show() you will probably notice that the 'contourf' contours are not always exactly the sames as the 'contour' contours. Why is it so? Don't contour and contourf use the same contour constructor? The same overall routine is used for contour as for contourf, but the contour tracing operation is not identical. Tracing a filled contour is much more complicated--that is probably why it is so hard to find filled contour routines. I suspect that whoever wrote the original code we are using wrote the line contour version first, then had to add quite a bit of logic and code to get it to make filled contours. Now, you may be wondering why we can't simply use the boundary of the filled regions for the lines as well, to guarantee they are the same. The reason is that filled contour boundaries include cuts connecting inner and outer contours, and also inner boundaries (edges of masked regions--except when affected by a bug) and the outer boundaries of the domain). It might be possible to simply exclude those line segments from the line contours, but it is not clear to me that the effort would be well-spent. I think that the differences illustrated in your example will occur almost entirely in pathologically ambiguous cases, but it is also possible that they reflect actual bugs or shortcomings of the algorithms used. Understanding the logic and tracing the code path in the present cntr.c is difficult; I have tried but failed to figure out and correct the interior masked region bug in contourf. If a better core contour routine with a suitable license could be found and substituted for the present one, that would be very nice. I have searched many times without turning anything up. Eric - 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] Merge colorbars from imshow and contour
Yannick Copin wrote: Hi, in a case similar to matplotlib-0.87.7/examples/contour_demo.py (figure 4), would it be possible to merge to two colorbars (a continuous one from imshow, a discrete one from contour) into a single colorbar? Indeed, in that case, the two colorbars are mostly redundant. Cheers. Yes, lines can be superimposed on a continuous colorbar. The demo is not ideal; I was mainly showing that one could use two colorbars for two different things. I have changed the contourf_demo.py in svn to include an example of a merged colorbar. Maybe I will change contour_demo.py later to make it an illustration of having colorbars for completely different fields, so it won't look so pointless as it does now. Eric - 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
Re: [Matplotlib-users] obtaining version info
I didn't see it either. For questions like this, I recommend heading to the #python channel on irc.freenode.net. If you find out how, please post. josh On Fri, 8 Dec 2006, belinda thom wrote: 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 - 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] obtaining version info
I assume there must be a reason for this:: import pylab pylab.__version__ Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'module' object has no attribute '__version__' That has always bothered me. But of course you can:: import matplotlib matplotlib.__version__ '0.87.7' hth, Alan Isaac - 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] zorder of legend
Sorry John, I see this was fixed a while ago - I was still using 0.87.3 from the last Enthought edition. Now that there's a scipy installer, I should upgrade numpy/scipy/mpl to something more current. Gary R. Gary Ruben wrote: While I think of it, I think the default zorder of legends should be bigger so that, by default it overlays all plot lines and symbols. Gary R. - 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
Re: [Matplotlib-users] obtaining version info
Alan G Isaac wrote: I assume there must be a reason for this:: import pylab pylab.__version__ Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'module' object has no attribute '__version__' That has always bothered me. But of course you can:: import matplotlib matplotlib.__version__ '0.87.7' After a little experimentation I have tentatively concluded that __version__ only gets imported if it is a package attribute--that is, if it is defined in __init__.py. Matplotlib is a package but pylab is just a module, so it does not seem to be possible to give it matplotlib's __version__. I could not find anything in the python documentation about this, though. Eric - 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