Re: [Matplotlib-users] Bug in NonUniformImage?
Only nearest and bilinear are supported for NonUniformImage. As you suggested, due to a small bug, an exception was not being raised when the interpolation is not one of those two options. This has now been fixed in SVN. Mike On 12/13/2010 01:47 PM, Nicolas Bigaouette wrote: Hi all, I'm using matplotlib.image.NonUniformImage() to plot a 2D rectilinear grid (non uniform spacing between points): im = matplotlib.image.NonUniformImage(grid, extent=extent, origin='lower', cmap = matplotlib.cm.jet, interpolation = nearest) im.set_data(x, y, z) ax.images.append(im) ax.set_xlim(extent_x) ax.set_ylim(extent_z) I have tried using a different interpolation value as in imshow(), but only nearest and bilinear gives expected results. All others ('bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc' and 'lanczos') show garbage instead of my data. If the other interpolations are not implemented, there should be at least an assert somewhere... Thanx -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] keypress event passing arguments
You can create an class to store these values with a method to handle the callback, eg. (untested code): class KeyHandler: def __init__(self): self.ImageNumber = 0 def OnKeyPress(self, event): self.ImageNumber += 1 key_handler = KeyHandler() plt.connect('key_press_event', key_handler.OnKeyPress) Mike On 12/11/2010 07:24 PM, John wrote: Hi all, I have set up an event handler and function to perform actions when a user presses certain keys in the plot window. The function needs access to variables that are in the main function. How do I pass these variables to the function. In OnKeyPress, ImageNumber and Li are objects in the main program. Any ideas on how to pass them? Thanks plt.connect('key_press_event',OnKeyPress) def OnKeyPress(self,event): print 'button= ',event.key, event.xdata, event.ydata if event.key == 'm': ImageNumber = ImageNumber + 1 if event.key == 'n': ImageNumber = ImageNumber - 1 rawimage = Li.GetImage(ImageNumber) plt.imshow(rawimage) plt.title(Image number %3d % (ImageNumber)) plt.draw() -- Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] unable to point pick 2nd axis after upgrade to mpl 1.0
It will work if you explicitly set its transform. star, = ax.plot([xdata[ind]], [ydata[ind]], '*', ms=40, mfc='y', mec='b', transform=thisline.get_transform()) JJ, thank you, this worked in my app as well. I also use the identity of the picked line in my code, since I provide additional information about that data series to the user based on which line (and point) they picked. So if reparenting the line loses that information, that's going to be a problem. I believe that reparenting only changes the axes attribute of the line, so it might not be a problem. Yes, it turns out it doesn't seem to cause any problem, which is great. When I was using matplotlib 0.98.5.2, I had the same code as I have now, with two different axes, and pick events were picked up on lines belonging to either of the axes. Unless I'm misunderstanding, something has changed and this used to be possible. Is that correct? Yes, I believe this used to be possible. While I'm not sure why it changed, I'm also not sure if we need to revert this change as I personally prefer the current simple behavior (although there could be a room for improvement). And I want to hear what others think. You may file a new feature request (or a bug if you want) issue regarding this. I don't know if the other developers have weighed in on this in some other forum or in personal communication, but as a user my vote is to keep the old behavior. I don't know how much of a simplicity benefit the developer team gets, but as a user I doubt I would have been able to figure out your suggestions based on Matplotlib documentation alone, unless maybe I am missing something. The previous way it worked strikes me as the user-intuitive way; this new way requires you to move a line to an axis that it doesn't match but then use its transform to decode what it really should be (if I understand it about right). And then one has to do that for every line. That seems complex from the user's perspective. Now that it is all in place it is no problem, but getting here was tough and un-doable without help. I guess I will file a feature request or bug report about it. So thank you very much, JJ, for all your help on at least three key details that massively improve the user experience of the app I am trying to put together. And thanks to John and the rest of the developers for Matplotlib! Che -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery
On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Thu, Sep 23, 2010 at 10:31 AM, C M cmpyt...@gmail.com wrote: Until a more permanent solution is figured out, can anyone recommend any workarounds, even if they are a little clunky? I'm embedding mpl plots in wxPython and am also finding this issue suboptimal. Che A (partial) workaround is possible using the axes_grid1 toolkit (i.e., you need matplotlib 1.0). Attached is a module I just cooked up (based on my previous attempt @ http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18129.html ), and it seems to work quite well. The usage is simple. ax = plt.axes([0,0,1,1]) ax.set_yticks([0.5]) ax.set_yticklabels([very long label]) make_axes_area_auto_adjustable(ax) # This is where axes_grid1 comes in Then, the axes area(including ticklabels and axis label) will be automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the above case). While this is mainly for a single axes plot, you may use it with multi-axes plot (but somewhat trickier to use). A few examples are included in the module. Regards, -JJ This thread is a few months old now, but I just wanted to mention that I am using JJ's workaround (thanks!) in my app--with either one or two y axes--and it is just excellent. This should definitely be at least an option for matplotlib users--the quality of the appearance of the plots now is like night and day, because, to me, seeing a plot without its axes labels (I'm talking about in a resizable plot embedded in an application, not a static graph for inclusion in a publication) is a *major* look and feel demerit. Che -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery
I'm using it too, with excellent results. Thanks JJ! On Tue, Dec 14, 2010 at 2:13 PM, C M cmpyt...@gmail.com wrote: On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee lee.j.j...@gmail.comwrote: On Thu, Sep 23, 2010 at 10:31 AM, C M cmpyt...@gmail.com wrote: Until a more permanent solution is figured out, can anyone recommend any workarounds, even if they are a little clunky? I'm embedding mpl plots in wxPython and am also finding this issue suboptimal. Che A (partial) workaround is possible using the axes_grid1 toolkit (i.e., you need matplotlib 1.0). Attached is a module I just cooked up (based on my previous attempt @ http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18129.html ), and it seems to work quite well. The usage is simple. ax = plt.axes([0,0,1,1]) ax.set_yticks([0.5]) ax.set_yticklabels([very long label]) make_axes_area_auto_adjustable(ax) # This is where axes_grid1 comes in Then, the axes area(including ticklabels and axis label) will be automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the above case). While this is mainly for a single axes plot, you may use it with multi-axes plot (but somewhat trickier to use). A few examples are included in the module. Regards, -JJ This thread is a few months old now, but I just wanted to mention that I am using JJ's workaround (thanks!) in my app--with either one or two y axes--and it is just excellent. This should definitely be at least an option for matplotlib users--the quality of the appearance of the plots now is like night and day, because, to me, seeing a plot without its axes labels (I'm talking about in a resizable plot embedded in an application, not a static graph for inclusion in a publication) is a *major* look and feel demerit. Che -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Daniel Hyams dhy...@gmail.com -- Daniel Hyams dhy...@gmail.com -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] One legend, two axes?
I am plotting a time series, a handful of moving averages and the standard deviation of one of the moving averages. The first crop of data are all in an overlapping range so are plotted using the left-hand y axis. The standard deviation range falls way outside the ranges of the other data streams, so I plot it on the right- hand axis. Since legends are associated with an axis how do I create one legend which covers all lines in the graph? I keep getting a complaint from mpl about the number of labels not matching the number of arrays being plotted (one v. five if I get the legend associated with the right-hand axis, four v. five if I get the legend associated with the left-hand axis). Thanks, Skip Montanaro s...@pobox.com -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AttributeError subplot2grid
I tried to upgrade to version 1.0 but without success. Could anybody tell where it went wrong? I downloaded the package matplotlib-1.0.0.tar.gz from http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/ First I tried a easy install, doing easy_install -m matplotlib-1.0.0.tar.gz from the command line but after this I checked the current version in Idle and it still was 0.99 So I manually removed all the matplotlib files from /usr/lib/pymodules/ and did the easy install again from the command line but now I can't import matplotlib anymore in Idle. This was the installation report: install_dir /usr/local/lib/python2.6/dist-packages/ Processing matplotlib-1.0.0.tar.gz Running matplotlib-1.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dWh4_f/matplotlib-1.0.0/egg-dist-tmp-ohZvCJ basedirlist is: ['/usr/local', '/usr'] BUILDING MATPLOTLIB matplotlib: 1.0.0 python: 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.3.0 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/local/include', '/usr/include', '.', * '/usr/local/include/freetype2', * '/usr/include/freetype2', './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/local/include', '/usr/include', '.' Tkinter: no * Using default library and include directories for * Tcl and Tk because a Tk window failed to open. * You may need to define DISPLAY for Tk to work so * that setup can determine where your libraries are * located. Tkinter present, but header files are not * found. You may need to install development * packages. wxPython: 2.8.11.0 * WxAgg extension not required for wxPython = 2.8 pkg-config: looking for pygtk-2.0 gtk+-2.0 * Package pygtk-2.0 was not found in the pkg-config * search path. Perhaps you should add the directory * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH * environment variable No package 'pygtk-2.0' found * Package gtk+-2.0 was not found in the pkg-config * search path. Perhaps you should add the directory * containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH * environment variable No package 'gtk+-2.0' found * You may need to install 'dev' package(s) to * provide header files. Gtk+: no * Could not find Gtk+ headers in any of * '/usr/local/include', '/usr/include', '.' Mac OS X native: no Qt: no Qt4: no Cairo: 1.8.8 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.4.1 pytz: 2010b OPTIONAL USETEX DEPENDENCIES dvipng: no ghostscript: 8.71 latex: no pdftops: 0.14.3 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.tri', 'matplotlib.delaunay'] warning: no files found matching 'MANIFEST' warning: no files found matching 'examples/data/*' warning: no files found matching 'lib/mpl_toolkits' gcc: error trying to exec 'cc1plus': execvp: No such file or directory error: Setup script exited with error: command 'gcc' failed with exit status 1 Hans R On Mon, 13 Dec 2010 14:13:32 -0600, Ryan May rma...@gmail.com wrote: On Mon, Dec 13, 2010 at 2:07 PM, vt603800 vt603...@base.be wrote: I get this error: AttributeError: 'module' object has no attribute 'subplot2grid' Are some modules
Re: [Matplotlib-users] One legend, two axes?
On Tue, Dec 14, 2010 at 2:29 PM, Skip Montanaro s...@pobox.com wrote: I am plotting a time series, a handful of moving averages and the standard deviation of one of the moving averages. The first crop of data are all in an overlapping range so are plotted using the left-hand y axis. The standard deviation range falls way outside the ranges of the other data streams, so I plot it on the right- hand axis. Since legends are associated with an axis how do I create one legend which covers all lines in the graph? I keep getting a complaint from mpl about the number of labels not matching the number of arrays being plotted (one v. five if I get the legend associated with the right-hand axis, four v. five if I get the legend associated with the left-hand axis). Thanks, Skip Montanaro s...@pobox.com Skip, You can call figlegend() and build a legend for the figure, irrespectively of any axes. With this function, you can explicitly pass it a list of the line objects and the labels. http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=legend#matplotlib.pyplot.figlegend I don't think it can automatically know about all of the lines in your graph (then again, I haven't tried and maybe it does). I hope this helps! Ben Root -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problems installing MPL on OS X 10.6 Snow Leopard with python2.7
On Mon, Dec 13, 2010 at 5:54 PM, Uri Laserson laser...@mit.edu wrote: Well, on my Linux system, when I get that error, it happens when I do an update of numpy, but fail to rebuild mpl. Here is the order how I build things: numpy, scipy, matplotlib. I would imagine ipython goes last. That has been my order as well. How can I track down why the import of numpy.core.multiarray is causing the problem? And why would it cause a problem only when MPL is being imported, but not if I import it manually? Originally, I tried to build the GitHub trunk version of numpy, but then abandoned that. Since MPL is saying that it was built against the 2... ABI rather than the 1... ABI, is it possible the MPL is finding some other version of numpy lying around? However, I'm pretty sure I deleted everything from the git numpy build. How could I pinpoint which numpy libraries are being linked against in the MPL build? Uri Uri, is it possible the MPL is finding some other version of numpy lying around? Yes, this is really the only remaining explanation. To find out which numpy is being used for the build process, I think if you save the output of the build process for mpl, I am fairly sure that that information is somewhere near the beginning of the build log. Ben Root -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problems installing MPL on OS X 10.6 Snow Leopard with python2.7
Strangely, it appears to find the correct numpy. More strangely, I picked a random order of doing things and suddenly it all works. I think what I ended up doing is this: Following builds using default setting without changing anything except: MACOSX_DEPLOYMENT_TARGET=10.6 python 2.7 numpy 1.5.1 with the flag --fcompiler=gnu95 mpl from github, setting the flags as I have posted earlier then set these flags: export MACOSX_DEPLOYMENT_TARGET=10.6 export CFLAGS=-arch i386 -arch x86_64 export FFLAGS=-m32 -m64 export LDFLAGS=-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64 -framework Accelerate then build scipy 0.8.0 with --fcompiler=gnu95 Then it all worked. Honestly, I don't understand why it should work because of this voodoo, but I am happily making figures now... Also of note, supposedly scipy 0.8 has problems with python 2.7. Version 0.9 should solve these problems (currently in beta). Thanks for the help! Uri ... Uri Laserson Graduate Student, Biomedical Engineering Harvard-MIT Division of Health Sciences and Technology M +1 917 742 8019 laser...@mit.edu On Tue, Dec 14, 2010 at 17:03, Benjamin Root ben.r...@ou.edu wrote: On Mon, Dec 13, 2010 at 5:54 PM, Uri Laserson laser...@mit.edu wrote: Well, on my Linux system, when I get that error, it happens when I do an update of numpy, but fail to rebuild mpl. Here is the order how I build things: numpy, scipy, matplotlib. I would imagine ipython goes last. That has been my order as well. How can I track down why the import of numpy.core.multiarray is causing the problem? And why would it cause a problem only when MPL is being imported, but not if I import it manually? Originally, I tried to build the GitHub trunk version of numpy, but then abandoned that. Since MPL is saying that it was built against the 2... ABI rather than the 1... ABI, is it possible the MPL is finding some other version of numpy lying around? However, I'm pretty sure I deleted everything from the git numpy build. How could I pinpoint which numpy libraries are being linked against in the MPL build? Uri Uri, is it possible the MPL is finding some other version of numpy lying around? Yes, this is really the only remaining explanation. To find out which numpy is being used for the build process, I think if you save the output of the build process for mpl, I am fairly sure that that information is somewhere near the beginning of the build log. Ben Root -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible to get variable spacing between certain subplots?
On 10/28/10 1:18 PM, Will Grover wrote: Hello matplotlib-users, I'm using subplots to make an array of plots, but because some of the plots have wider y-axis tick labels than others, some of the subplots end up looking too close to each other. Here's an image that shows what I mean: http://web.mit.edu/wgrover/www/spacing.png I'm currently using pylab.subplots_adjust(hspace = __, vspace = __) to adjust the subplot spacing, but since that applies to all subplots, no one setting looks right for the entire array of plots. Is there any way to set the spacing so that the subplots *plus tick labels* are evenly distributed? Or can I manually specify the spacing between each subplot? Thanks, (to those more knowledgeable than me...) Is this something that ImageGrid would solve? http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 Also, could you use subplotpar to adjust spacing in each subplot? http://matplotlib.sourceforge.net/users/gridspec.html#adjust-gridspec-layout Thanks, Jason -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users