Re: [Matplotlib-users] Unequal size gangplots
You should be able to use http://leejjoon.github.com/mpl_toolkits-gridspec/ for unequal-size plots of the type you describe. Alan Isaac -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unequal size gangplots
On Mon, Jun 21, 2010 at 2:33 PM, Jeffrey Blackburne wrote: > I have used add_axes() to do this in the past. E.g., > > import matplotlib.pyplot as plt > > fig = plt.figure() > leftmarg = 0.125 # change these numbers to taste > botmmarg = 0.125 > width = 0.825 > height = 0.825 > frac = 2./3. > ax0 = fig.add_axes([leftmarg, botmmarg, width, frac*height]) > ax1 = fig.add_axes([leftmarg, botmmarg+frac*height, width, (1-frac)*height]) > ax1.xaxis.set_ticklabels([]) > plt.show() > > Sorry it is in object-oriented style instead of pylab style... > Thanks! This looks like it might work. I'll give it a try. Jeremy -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unequal size gangplots
I have used add_axes() to do this in the past. E.g., import matplotlib.pyplot as plt fig = plt.figure() leftmarg = 0.125 # change these numbers to taste botmmarg = 0.125 width = 0.825 height = 0.825 frac = 2./3. ax0 = fig.add_axes([leftmarg, botmmarg, width, frac*height]) ax1 = fig.add_axes([leftmarg, botmmarg+frac*height, width, (1-frac) *height]) ax1.xaxis.set_ticklabels([]) plt.show() Sorry it is in object-oriented style instead of pylab style... On Jun 21, 2010, at 3:13 PM, Jeremy Conlin wrote: > I have followed this excellent example: > http://matplotlib.sourceforge.net/examples/pylab_examples/ > ganged_plots.html > > but I would like my plots to be 2/3 and 1/3 of the total height of the > figure (I only have 2 plots). What do I have to do to specify the > relative sizes of the figures? > > Thanks, > Jeremy > > -- > > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unequal size gangplots
Jeremy Conlin > I have followed this excellent example: > http://matplotlib.sourceforge.net/examples/pylab_examples/ganged_plots.html > > but I would like my plots to be 2/3 and 1/3 of the total height of the > figure (I only have 2 plots). What do I have to do to specify the > relative sizes of the figures? may something like ax1 = fig.add_subplot(311) ax2 = fig.add_subplot(212) work? if I look at pyplot.setp(ax1) I see a lot of things (like "position" or "anchor" or "axes_locator") which might work. Good luck, Malte -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Unequal size gangplots
I have followed this excellent example: http://matplotlib.sourceforge.net/examples/pylab_examples/ganged_plots.html but I would like my plots to be 2/3 and 1/3 of the total height of the figure (I only have 2 plots). What do I have to do to specify the relative sizes of the figures? Thanks, Jeremy -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] building on MAC snow leopard
This doesn't solve the original problem and I know I worked out a way to do it before my hard disk messed up! But it seems you can get a version going through macports... sudo port install py26-matplotlib sudo port install python_select sudo python_select python26 then edit your .matplotlib/matplotlibrc file (make one if you don't have it). And put backend: macosx into it. Should work fine. Does for me. Now I don't know how one would set python up so it doesn't find my other version, other than moving paths around. Or setting it up so easy_install using the /opt/ version of python. Anyone? thanks Martin -- View this message in context: http://old.nabble.com/building-on-MAC-snow-leopard-tp28947568p28951913.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with RectangleSelector
On 06/21/2010 06:10 AM, Matthias Michler wrote: > Hello list, > > I'm encountering a strange problem with the RectangleSelector using the latest > version of svn. Namely it doesn't work if it wasn't initialized as > RS = RectangleSelector(...) > but using > RectangleSelector(...) > in my script. > > I modified the example rectangle_selector.py from the folder examples/widgets > to illustrate my observation. > > Can anybody reproduce my findings or even explain what is going on? If you don't keep a reference to the RectangleSelector object, it vanishes--it is garbage-collected. Eric > > Thanks in advance for any comments. > > Kind regards, > Matthias -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Installation for MAC OS 10.5
> Which 2.6? Any would be better than none, but I have 2.6.5 (the most recent) from python.org. > think that needs the 2.6 from Python.org -- I'd try that if it's not > what you're using already -- if you are, then what errors, etc do you get? That's not the problem, as that's the version of Python I have. The problem is that the installer doesn't recognize that Python is installed and hence won't let matplotlib be installed at all. -- R. Padraic Springuel Research Assistant Department of Physics and Astronomy University of Maine Bennett 309 Office Hours: By Appointment Only -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] problem with RectangleSelector
Hello list, I'm encountering a strange problem with the RectangleSelector using the latest version of svn. Namely it doesn't work if it wasn't initialized as RS = RectangleSelector(...) but using RectangleSelector(...) in my script. I modified the example rectangle_selector.py from the folder examples/widgets to illustrate my observation. Can anybody reproduce my findings or even explain what is going on? Thanks in advance for any comments. Kind regards, Matthias """ Do a mouseclick somewhere, move the mouse to some destination, release the button. This class gives click- and release-events and also draws a line or a box from the click-point to the actual mouseposition (within the same axes) until the button is released. Within the method 'self.ignore()' it is checked wether the button from eventpress and eventrelease are the same. """ from matplotlib.widgets import RectangleSelector import numpy as np import matplotlib.pyplot as plt def line_select_callback(eclick, erelease): 'eclick and erelease are the press and release events' x1, y1 = eclick.xdata, eclick.ydata x2, y2 = erelease.xdata, erelease.ydata print "(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2) print " The button you used were: ", eclick.button, erelease.button def toggle_selector(event): print ' Key pressed.' if event.key in ['Q', 'q'] and toggle_selector.RS.active: print ' RectangleSelector deactivated.' toggle_selector.RS.set_active(False) if event.key in ['A', 'a'] and not toggle_selector.RS.active: print ' RectangleSelector activated.' toggle_selector.RS.set_active(True) current_ax = plt.subplot(111)# make a new plotingrange N = 10 # If N is large one can see x = np.linspace(0.0, 10.0, N)# improvement by use blitting! plt.plot(x, +np.sin(.2*np.pi*x), lw=3.5, c='b', alpha=.7) # plot something plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5) plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3) print "\n click --> release" # drawtype is 'box' or 'line' or 'none' #toggle_selector.RS = #RS = RectangleSelector(current_ax, line_select_callback, drawtype='box', useblit=True, button=[1,3], # don't use middle button minspanx=5, minspany=5, spancoords='pixels') #plt.connect('key_press_event', toggle_selector) plt.show() -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] building on MAC snow leopard
> Do you have some notes on how you achieved this? It is more than I've > been able to do. Yes I firstly setup a brand new python, i.e. not the one that ships with snow leopard (ver2.6.5). Then followed everything on http://blog.hyperjeff.net/?p=160 >I'm not a build or gcc expert, but am interested in the solution to this >-- I have also tried (without success) to get this compiled on OS X >10.6. A few potentially useful pointers: >1. Check that you have the latest version of XCode. yep > 2. Check that you have a recent version of gfortran. yep >3. Check your path to various tools: > http://mail.scipy.org/pipermail/numpy-discussion/2007-January/025669.html yep. I came across this which seems to be the ticket, though this also doesn't work... http://www.trondkristiansen.com/?page_id=79 when I follow it through it builds but I get a seg fault when I run it. I payed more attention to the build and I think the issue stems from the arch flags... eg. [hal-9...@matplotlib-0.99.3]$ make -f make.osx mpl_build blah, blah ld: warning: in /usr/local/lib/libstdc++.dylib, file was built for unsupported file format which is not the architecture being linked (i386) thanks -- View this message in context: http://old.nabble.com/building-on-MAC-snow-leopard-tp28947568p28948915.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] building on MAC snow leopard
On 6/21/10 7:41 AM, mdekauwe wrote: > So I have successfully built a 64bit version of Numpy, Scipy from svn and am > using python version 2.6.5. However in trying to follow the instructions o Do you have some notes on how you achieved this? It is more than I've been able to do. > I had a look at the config.log file in the libpng directory and the main > thing I can see is... > > configure:3266: checking for C compiler default output file name > configure:3288: gcc -arch i386 -arch x86_64 -I/usr/local/include > -I/usr/local/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk > -arch i386 -arch x86_64 -L/usr/local/lib > -syslibroot,/Developer/SDKs/MacOSX10.6.sdk conftest.c >&5 > gcc: unrecognized option '-syslibroot,/Developer/SDKs/MacOSX10.6.sdk' > cc1: error: unrecognized command line option "-arch" > cc1: error: unrecognized command line option "-arch" > cc1: error: unrecognized command line option "-arch" > cc1: error: unrecognized command line option "-arch" > I'm not a build or gcc expert, but am interested in the solution to this -- I have also tried (without success) to get this compiled on OS X 10.6. A few potentially useful pointers: 1. Check that you have the latest version of XCode. 2. Check that you have a recent version of gfortran. 3. Check your path to various tools: http://mail.scipy.org/pipermail/numpy-discussion/2007-January/025669.html Ian -- Ian Stokes-Rees, PhD W: http://hkl.hms.harvard.edu ijsto...@hkl.hms.harvard.edu T: +1 617 432-5608 x75 NEBioGrid, Harvard Medical School C: +1 617 331-5993 -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] building on MAC snow leopard
Hi, So I have successfully built a 64bit version of Numpy, Scipy from svn and am using python version 2.6.5. However in trying to follow the instructions on this blog (http://blog.hyperjeff.net/?p=160), namely... changing the make.osx file to MACOSX_DEPLOYMENT_TARGET=10.6 PREFIX=/usr/local ## You shouldn't need to configure past this point (and yet…) PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" CFLAGS="-arch i386 -arch x86_64 -I${PREFIX}/include -I${PREFIX}/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk" LDFLAGS="-arch i386 -arch x86_64 -L${PREFIX}/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk" FFLAGS="-arch i386 -arch x86_64" and uncommenting wxagg = False from the setup.cfg I still seem to run into trouble. Command I am running is sudo make -f make.osx fetch deps mpl_build mpl_install which runs into trouble to do with the libpng lib... x libpng-1.2.39/scripts/makefile.ne12bsd checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... ./install-sh -c -d checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking for C compiler default output file name... configure: error: in `/Users/mdekauwe/src/packages/matplotlib_svn/libpng-1.2.39': configure: error: C compiler cannot create executables See `config.log' for more details. make: *** [png] Error 77 I had a look at the config.log file in the libpng directory and the main thing I can see is... configure:3266: checking for C compiler default output file name configure:3288: gcc -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -L/usr/local/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk conftest.c >&5 gcc: unrecognized option '-syslibroot,/Developer/SDKs/MacOSX10.6.sdk' cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" Not sure what the issue with the arch flag is? Would really appreciate some thoughts on this, many thanks Martin -- View this message in context: http://old.nabble.com/building-on-MAC-snow-leopard-tp28947568p28947568.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] displaying multiple images in series
Hi Daniel, show should be called only once in a script (see also: http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=show#use-show) and it starts the mainloop, in which the user may interact with the plot using for instance button or key press events like in my second example. Whenever a key-press-event is recognized the function "event_fct" is called with the corresponding key-press-event as argument. This key-press-event holds information like which key was used etc.. All the possible interaction you can have with the plot in this case happens after the plt.show in the "mainloop", where matplotlib waits for events to happen and calls the corresponding functions, which were "connect"ed to the event. You will find more information about the event handling in the documentation of matplotlib (e.g. http://matplotlib.sourceforge.net/users/event_handling.html#event-handling- tutorial or the examples at http://matplotlib.sourceforge.net/examples/event_handling/index.html). In my first example the trick is done by the function "waitforbuttonpress" and all the interaction happens before the show-command. Because I'm not so familiar with this function, I suggest you again to use the documentation and the examples to learn more about this functionality. Kind regards, Matthias On Monday, June 21, 2010 05:47:21 am you wrote: > Hi Matthias, > Thanks for the script! Now I would like to try to understand why it > works :) . In both of the scripts you sent me, plt.draw() is called > inside the loop to display each image file, and plt.show() is called > outside the loop at the end of the script. I guess what I find > confusing is, how is it that the images are displayed on screen, > inside the loop, *before* plt.show() is called? I would have expected > only the very last image inside the loop to be displayed, using this > program structure. So apparently there is something here I do not > understand... -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users