Re: [Matplotlib-users] segfault with Tkagg
I'm still investigating for my segmentation fault pb with matplotlib and Tkagg, but now, I have no more idea. Here is a summary of my investigations : = CONFIGURATION = I'm trying to make a local installation of the following programs on a GNU/Linux i686 (32 bits) : - gcc-4.2.3 - tcl8.5.1 - tk8.5.1 - Python-2.5.2 - numpy-1.0.4 - scipy-0.6 - matplotlib-0.91.2 I used the option --prefix=${INSTALL_DIR} everywhere, and I compiled gcc, tcl tk and Python with the options --enable-shared --enable-threads. For building numpy, scipy and matplotlib, I defined a shell varaible named python in order to call the python version installed in $INSTALL_DIR. All compilation are made from the official source tarballs. I haven't seen any compilation problem in the log of theses compilations, and all tests are running fine. == INSTALLING MATPLOTLIB == I've put verbose=True in my setup.cfg file (but didn't see a lot of change with that) : $ cat setup.cfg [ status ] verbose=True $python setup.py install --prefix=${INSTALL_DIR} --- BUILDING MATPLOTLIB matplotlib: 0.91.2 python: 2.5.2 (r252:60911, Feb 26 2008, 22:21:12) [GCC 4.2.3] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.0.4 freetype2: 9.16.3 OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.15beta5 Tkinter: Tkinter: 50704, Tk: 8.5, Tcl: 8.5 wxPython: no * wxPython not found Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provide OPTIONAL USETEX DEPENDENCIES dvipng: 1.9 ghostscript: 8.15.3 latex: 3.141592 pdftops: 3.00 EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES configobj: matplotlib will provide enthought.traits: matplotlib will provide [Edit setup.cfg to suppress the above messages] -- I didn't see any compilation error, only a lot of messages saying : """ cc1plus: attention : l'option de la ligne de commande "-Wstrict-prototypes" est valide pour Ada/C/ObjC mais pas pour C++ """ == TESTING MATPLOTLIB == $ source setenv_bash# setup environment to call the local version of python $ cat test.py from pylab import * plot([1, 2, 3]) show() $ python2.5 test.py --verbose-debug-annoying $HOME=/home/loic CONFIGDIR=/home/loic/.matplotlib matplotlib data path /home/loic/tmp/bluelagoon/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /home/loic/.matplotlib/matplotlibrc matplotlib version 0.91.2 verbose.level debug-annoying interactive is False units is True platform is linux2 loaded modules: ['_bisect', 'xml.sax.urlparse', 'distutils', 'pylab', 'datetime', 'matplotlib.tempfile', 'distutils.sysconfig', 'encodings.encodings', 'pytz.cStringIO', 'xml', 'struct', 'tempfile', 'xml.sax.urllib', '_struct', 'pytz.os', 'matplotlib.matplotlib', 'string', 'encodings.utf_8', 'matplotlib.__future__', 'pytz.tzinfo', 'pytz.datetime', 'distutils.re', 'bisect', 'signal', 'random', 'xml.sax.xmlreader', 'matplotlib.pytz', 'pytz.tzfile', 'cStringIO', 'locale', 'xml.sax.saxutils', 'encodings', 'dateutil', 'matplotlib.warnings', 'matplotlib.string', 'pytz.pytz', 'urllib', 'matplotlib.sys', 're', 'math', 'fcntl', 'UserDict', 'distutils.os', 'matplotlib', 'codecs', 'md5', '_locale', 'matplotlib.sre_constants', 'matplotlib.os', 'thread', 'weakref', 'itertools', 'distutils.sys', 'os', 'sre_parse', '__future__', 'matplotlib.copy', 'xml.sax.types', '_sre', '__builtin__', 'matplotlib.re', 'operator', 'distutils.string ', 'matplotlib.datetime', 'posixpath', 'errno', '_socket', 'binascii', 'sre_constants', 'matplotlib.md5', 'types', 'pytz.sys', 'xml.sax.handler', 'xml.sax.os', 'matplotlib.xml', '_codecs', 'pytz', 'matplotlib.pyparsing', 'copy', 'socket', '_types', 'matplotlib.dateutil', 'hashlib', 'posix', 'encodings.aliases', 'matplotlib.fontconfig_pattern', 'exceptions', 'xml.sax._exceptions', 'pytz.bisect', 'distutils.distutils', 'copy_reg', 'sre_compile', 'xml.sax', '_hashlib', '_random', 'pytz.struct', 'site', 'zipimport', '__main__', 'shutil', 'matplotlib.weakref', 'strop', ' encodings.codecs', 'gettext', 'matplotlib.rcsetup'
Re: [Matplotlib-users] raster in basemap
Lionel Roubeyrie wrote: > Hi all, > I'm sure it's a trivial question, but can't find any valid answer in the > basemap examples directory or with google : I have a georeferenced TIFF file > in 'lcc' projection, representing a little portion of France, and I need to > put it on a map, resets map limits to a closed portion of the map, and put > contours on it. I see how to initialise Basemap with the limits of the > raster, but not how to "make a zoom" in the map by specifing coordinates. > Thanks for your help > Lionel: You can use the set_xlim and set_ylim axes methods to manually 'zoom' the plot. It has to be done after all the other plotting though, since all the Basemap methods (contour, imshow etc) will reset the axes limits to show the entire map region. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Scatterplot problem
I'm having a couple of problems drawing a basic relational scatter plot. (Specifically, it's called a dot-dash-plot in the book I have and is described as "framing the bivariate scatter with the marginal distribution of each variable.") The idea is that you have a bivariate scatter plot and use the two marginal frequency distributions of the data as the two axes. 1. By setting the x and y tick length and using space characters as the tick labels I was able to get ticks only and no labels on the axes as I want. But these ticks appear along the top and right edges of the plot, as well as the left and bottom. Is there any way to get rid of the top and right ticks? 2. I'm getting phantom numbers on my axes, the 0.2, 0.4, 0.6 etc. I don't know where these are coming from or what they measure (my data ranges from 0-7 on both axes, not 0-1). 3. I want to label each data point with a string. I'm doing this with annotate but the strings sometimes overlap each other. Any idea how to avoid this? Here's a PNG of my plot as it is: http://img137.imageshack.us/img137/4015/scatterplotlk2.png And here's the source: # datax and datay are equal length lists of floats, the data I want to # plot. labels is another equal length list containing the strings I # want to label the data points with. All three lists are in the same # order. axes(frameon=False) rc('xtick.major',size=8) rc('xtick',direction='out') xticks(datax,' '*len(datax)) rc('ytick.major',size=8) rc('ytick',direction='out') yticks(datay,' '*len(datay)) plot(datax,datay,'r.') plot([0,7],[0,7]) xlabel('Proportion of total number of cards, week 1') ylabel('Proportion of total number of cards, week 2') title('Frequency of cards per function') for label,x,y in map(None,labels,datax,datay): annotate(function,xy=(x,y),size=8) Thanks! - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] strangely shifted PostScript output when
To me it sounds like the bounding box is miscalculated when the axis are turned off. What you could do as a workaround, is add a fill to the figure that has the exact same size as the axis box. Maybe then, when you turn the axis off it will keep the same size? May be an ugly workaround, but worth a shot. You also don't have to set the backgroundcolor of your plot anymore. Mark On Tue, Feb 26, 2008 at 3:22 PM, Jochen Voss <[EMAIL PROTECTED]> wrote: > Hi Mark, > > On Tue, Feb 26, 2008 at 11:30:55AM +0100, Mark Bakker wrote: > > As a workaround, can you just turn the axis box and ticks off? > > > > xticks([]) > > yticks([]) > > setp(ax,'frame_on',False) > > > > Or does that give the same problem? > > Unfortunately the problem also occurs when I replace the axis("off") > with the lines suggested by you. The xticks commands work, but the > setp breaks things again: > > with setp (broken output): > >[EMAIL PROTECTED] [~/project/kalman/survey/fig2] grep -i BoundingBox > out.eps >%%BoundingBox: 1 300 326 417 >%%HiResBoundingBox: 1.923182 300.843797 325.923182 416.043797 > > without setp (output looks ok but has an extra frame): > >[EMAIL PROTECTED] [~/project/kalman/survey/fig2] grep -i BoundingBox > out.eps >%%BoundingBox: 143 338 468 454 >%%HiResBoundingBox: 143.91 338.520012 467.91 453.720012 > > Is there anything else I can try? > > Many thanks, > Jochen > -- > http://seehuhn.de/ > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFHxCC7f+iD8yEbECURAlbHAKCtb0KbmVSQJV3upSGfwp5ytP4J0gCfRKQm > QvynbyKTxvsKQuAiy5EWyOI= > =Wx7H > -END PGP SIGNATURE- > > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] raster in basemap
Hi all, I'm sure it's a trivial question, but can't find any valid answer in the basemap examples directory or with google : I have a georeferenced TIFF file in 'lcc' projection, representing a little portion of France, and I need to put it on a map, resets map limits to a closed portion of the map, and put contours on it. I see how to initialise Basemap with the limits of the raster, but not how to "make a zoom" in the map by specifing coordinates. Thanks for your help -- Lionel Roubeyrie - [EMAIL PROTECTED] Chargé d'études et de maintenance LIMAIR - la Surveillance de l'Air en Limousin http://www.limair.asso.fr - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] strangely shifted PostScript output when
Hi Mark, On Tue, Feb 26, 2008 at 11:30:55AM +0100, Mark Bakker wrote: > As a workaround, can you just turn the axis box and ticks off? > > xticks([]) > yticks([]) > setp(ax,'frame_on',False) > > Or does that give the same problem? Unfortunately the problem also occurs when I replace the axis("off") with the lines suggested by you. The xticks commands work, but the setp breaks things again: with setp (broken output): [EMAIL PROTECTED] [~/project/kalman/survey/fig2] grep -i BoundingBox out.eps %%BoundingBox: 1 300 326 417 %%HiResBoundingBox: 1.923182 300.843797 325.923182 416.043797 without setp (output looks ok but has an extra frame): [EMAIL PROTECTED] [~/project/kalman/survey/fig2] grep -i BoundingBox out.eps %%BoundingBox: 143 338 468 454 %%HiResBoundingBox: 143.91 338.520012 467.91 453.720012 Is there anything else I can try? Many thanks, Jochen -- http://seehuhn.de/ signature.asc Description: Digital signature - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] strangely shifted PostScript output when
As a workaround, can you just turn the axis box and ticks off? xticks([]) yticks([]) setp(ax,'frame_on',False) Or does that give the same problem? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Re : Matplotlib-users Digest, Vol 21, Issue 36
>Date: Fri, 22 Feb 2008 08:15:34 -0600 >From: "John Hunter" <[EMAIL PROTECTED]> >Subject: Re: [Matplotlib-users] What is the proper way to set y tick > labelsfor a histogram ? >To: " Aur? Gourrier " <[EMAIL PROTECTED]> >Cc: matplotlib-users@lists.sourceforge.net >Message-ID: > <[EMAIL PROTECTED]> >Content-Type: text/plain; charset=ISO-8859-1 > >On Fri, Feb 22, 2008 at 7:52 AM, Aur? Gourrier ><[EMAIL PROTECTED]> wrote: > >> Rather trivial... but instead of the plotting the counts n, I'd like to plot >> the realtive percentage counts, i.e. n/len(x). I can't really use the option >> normed = 1 which plots n/(len(x)*dbins). I guess the simplest way would be >> to simply change the yticklabels (by dividing them by len(x)). The thing is >> that I simply cannot find out how to do this... >> >> I tried using the axes.set_yticklabels() but doesn't work. I've also tried >> to find the child containing the label but couldn't find it (not in Axes, >> nor in YAxis etc...). I guess it must be a Text instance. > >You can set your own custom tick formatter: > >import matplotlib.ticker as ticker > >N = len(x) >def fmt_percent(x, pos=None): > return '%1.2f'%(float(x)/N) > >ax.xaxis.set_major_formatter(ticker.FuncFormatter(fmt_percent)). See >http://matplotlib.sourceforge.net/examples/custom_ticker1.py for a >complete example. > >JDH Thanks, that's something I had not looked into yet and will definetly be useful for other pbs I had... Cheers, Aure __ Yahoo! Mail : un mail innovant avec Messenger compatible Windows Live + stockage illimité. http://mail.yahoo.fr- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Re : plot a histogram of relative percentage of data
Yep, that's what I did in the end... it also means that a simple argument could be added to the axes.hist() to do such operation, I described this in a previous post (see below, changes are in major cap). Thanks for the tip, Aure def hist(self, x, bins=10, RELPERCENT = 1, normed=0, bottom=None, align='edge', orientation='vertical', width=None, log=False, **kwargs): """ if not self._hold: self.cla() n, bins = npy.histogram(x, bins, range=None, normed=normed) IF NOT NORMED AND RELPERCENT: N = N/FLOAT(LEN(X)) if width is None: width = 0.9*(bins[1]-bins[0]) if orientation == 'horizontal': patches = self.barh(bins, n, height=width, left=bottom, align=align, log=log) elif orientation == 'vertical': patches = self.bar(bins, n, width=width, bottom=bottom, align=align, log=log) else: raise ValueError, 'invalid orientation: %s' % orientation for p in patches: p.update(kwargs) return n, bins, cbook.silent_list('Patch', patches) - Message d'origine De : Bernhard Voigt <[EMAIL PROTECTED]> À : Auré Gourrier <[EMAIL PROTECTED]> Cc : matplotlib-users@lists.sourceforge.net Envoyé le : Dimanche, 24 Février 2008, 19h10mn 47s Objet : Re: [Matplotlib-users] plot a histogram of relative percentage of data Hi! You could also use the bar method and do the histogram with numpy: import numpy as n import pylab as p foo = n.random.normal(size=100) p.hist(foo, 20) p.twinx() counts, bins = n.histogram(foo, 20) counts = counts.astype(float)/len(foo) width = (bins[1]-bins[0]) * .9 p.bar(bins ,counts, width=width, fc='r') Cheers! Bernhard On Fri, Feb 22, 2008 at 4:08 PM, Auré Gourrier <[EMAIL PROTECTED]> wrote: Hi all, In my latest post, I wanted to use the mpl.hist() function in a different way, i.e.: x = datalist bins= 100 hist(x,bins,normed=0) #returns a tupple (n,bins,patches) Instead of ploting the number of counts n, I wanted to plot the relative percentage of counts, i.e. n/len(x). I can't really use the option normed=1 which returns n/(len(x)*dbin). In the axes.py module, this would simply mean adding an argument e.g. relpercent = 1. I added the code line to show how this could be done (in major cap). If this is useful, how could it be modified in the distribution ? def hist(self, x, bins=10, RELPERCENT = 1, normed=0, bottom=None, align='edge', orientation='vertical', width=None, log=False, **kwargs): """ if not self._hold: self.cla() n, bins = npy.histogram(x, bins, range=None, normed=normed) IF NOT NORMED AND RELPERCENT: N = N/FLOAT(LEN(X)) if width is None: width = 0.9*(bins[1]-bins[0]) if orientation == 'horizontal': patches = self.barh(bins, n, height=width, left=bottom, align=align, log=log) elif orientation == 'vertical': patches = self.bar(bins, n, width=width, bottom=bottom, align=align, log=log) else: raise ValueError, 'invalid orientation: %s' % orientation for p in patches: p.update(kwargs) return n, bins, cbook.silent_list('Patch', patches) Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users __ Yahoo! Mail : un mail innovant avec Messenger compatible Windows Live + stockage illimité. http://mail.yahoo.fr- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users