Re: [Matplotlib-users] basemap via macports [solved]
Indeed I was running Apple Python instead of macport. Thanks for all that pointed it out. best Carlos On Fri, Aug 24, 2012 at 11:46 AM, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hello all, I just did a fresh macports install, and installed py27-matplotlib-basemap, so all dependencies were installed as well. After installing python, I did run port-select (or something like it) to make sure I'm using macports python. My problem is that I can't run it: GuanoMac:~ guano$ python Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type help, copyright, credits or license for more information. from mpl_toolkits.basemap import Basemap Traceback (most recent call last): File stdin, line 1, in module ImportError: No module named basemap Anyone experienced in this kind of installation could share hints? tks Carlos -- Prof. Carlos Henrique Grohmann Institute of Geosciences - Univ. of São Paulo, Brazil - Digital Terrain Analysis | GIS | Remote Sensing - http://carlosgrohmann.com Can’t stop the signal. -- Prof. Carlos Henrique Grohmann Institute of Geosciences - Univ. of São Paulo, Brazil - Digital Terrain Analysis | GIS | Remote Sensing - http://carlosgrohmann.com Can’t stop the signal. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] py2app setup.py example?
Hello Robert, Thank you for your kind response, but I'm looking into py2app, for Mac OSX, and it is a bit different than py2exe. I do have a py2exe script working (lots of examples around), but I'm still a bit lost on the Mac-related stuff. cheers Carlos On Thu, Sep 1, 2011 at 05:34, Robert Sudwarts robert.sudwa...@gmail.comwrote: Hi Carlos, It's a bit tricky giving you a complete example as the specifics will vary considerably depending on which versions of python, matplotlib wx you're using: I'd point you toward the wxPyWiki page at: http://wiki.wxpython.org/py2exe-python26 which gives a pretty sound example based on an output produced by GUI2Exe (written by Andrea Gavana) As for matplotlib specifically, see: http://www.py2exe.org/index.cgi/MatPlotLib (again depending very much on the versions you're using), I've found that the first example given works perfectly. Hope that helps! On 1 September 2011 04:42, Carlos Grohmann carlos.grohm...@gmail.comwrote: Hello all. I've been looking for a good example of setup.py to build a bundle app with wxpython+matplotlib. Can someone share or point me in a direction? thanks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] py2app setup.py example?
Hello all. I've been looking for a good example of setup.py to build a bundle app with wxpython+matplotlib. Can someone share or point me in a direction? thanks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] fixing figure size on wxpython app
Hi all, I'm developing an app for structural geology called OenStereo ( www.igc.usp.br/openstereo), using matplotlib and wxpython. So far, I'm really happy with the results, but there is still one thing annoying me: when I save the plots (using the save icon in the NavigationToolbar), the resulting figure size is determined by the size of the window. Can I set this to a fixed value (like 15cm)? this is a part of the code where I create the figure: #initialize the figure and canvas self.stereoFigure = Figure(figsize=(4,4),facecolor='white') self.stereoCanvas = FigureCanvas(self, -1, self.stereoFigure) self.toolbar = VMToolbar(self.stereoCanvas) self.stereoCanvas.mpl_connect(motion_notify_event, self.OnMove) #initialize the plot area self.plotaxes = self.stereoFigure.add_axes([0.01, 0.01, 0.6, 0.98], clip_on='True',xlim=(-1.1,1.2), ylim=(-1.15,1.15), adjustable='box',autoscale_on='False',label='stereo') self.plotaxes.set_axis_off() self.plotaxes.set_aspect(aspect='equal', adjustable=None, anchor='W') best Carlos -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] EMF support?
Hello there Is there support for exporting graphics as EMF files? From what I've seen it seems to be discontinued. best Carlos -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] issues when saving files - no automatic extension added in dialog
Hello all, I'm developing a software for Geology, using wxpython for the GUI. When I want to export any graphics, clicking on the save button on the MPL toolbar, I get a dialog to save the file (with a default image.png filename) and where I can choose between some file formats. When I select any format from the drop-down list, I expected it to change the extension of the file on the dialog, but it doesn't. So I have to set it up manually. Is this a bug? thanks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] citation of mpl
many thanks. very useful info. Carlos On Thu, Sep 23, 2010 at 17:03, John Hunter jdh2...@gmail.com wrote: On Thu, Sep 23, 2010 at 2:33 PM, Chloe Lewis chle...@berkeley.edu wrote: Well, I had my bib program open, so here are a couple formats: Thanks for posting these. I added this to the FAQ: http://matplotlib.sourceforge.net/faq/howto_faq.html#cite-matplotlib JDH -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] py2exe and matplotlib - Fonts: do I need them all?
Many thanks Ben! I went and removed all fonts but regular helvetica and vera, also I removed all but the .png files under images, and now my mpl-data is about 250 kb. cheers Carlos On Thu, Sep 16, 2010 at 21:39, Benjamin Root ben.r...@ou.edu wrote: On Thu, Sep 16, 2010 at 5:33 PM, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hello all, Is it OK to remove the fonts I don't use? (I use only sans-serif) By Ok I mean not only from the practical poin tof view (that is, will the app run?) but also from the _legal_ point of view (am I obliged to distribute all those fonts?) Carlos, Just to make it very clear, matplotlib is open sourced. You are free to modify the package to your heart's content, however you see fit. Matplotlib only asks that you keep the copyright notice with the distributed software (in particular, the matplotlib/license/LICENSE file applies here, as well as others.) With regards to fonts, refer to the matplotlib/license/LICENSE_STIX file. My understanding of that license (though, IANAL), is that you don't have to worry about anything above and beyond just simply including the license file unless you are eliminating individual glyphs from a font (or adding glyphs). However, I don't see any reason why you can't constrain yourself to a particular font. Note that you are not allowed to sell any particular font in the package, though you are allowed to charge a distribution fee for the font software. Generally speaking, my rule of thumb is that if you are distributing open-source software in the same spirit you have received it, you are satisfying the spirit of the licenses. The only thing remaining is whether the source code has to accompany the software or not. The core part of matplotlib is BSD licensed (or similar) and does not require that (although it is encouraged!). Important! Note that the basemap package is GPL-licensed, and is required to have its source code accompany its software. However, unless your program *depends* on basemap for it to function, the source code to your program is not required to be GPL-ed. And, as always, I am not a lawyer. I am merely conveying my understanding and experience with software licensing. Anyone else is free to add to and/or correct what I have said here. I hope this helps! Ben Root -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] automatically change file extension when saving
Hi there, I've been looking for a way to automatically set the extension of a file when saving a plot via the navigationBar 'save' button. In my case, when I change the file type, the extension of the default filename ('image.png') won't change. I'd like it to change to the extension of the file type I selected. best carlos -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] py2exe and matplotlib - Fonts: do I need them all?
Hello all, I'm new to py2exe but I managed to create a binary executable of my program. Now I'm experiencing on how to make the final size of the binary smaller. I already managed to cut about 15Mb by removing calls to pyQt (I use Wxpython) and also to scipy. One thing that is still bothering me is the mpl_data directory that holds about 3.5 Mb of fonts. Is it OK to remove the fonts I don't use? (I use only sans-serif) By Ok I mean not only from the practical poin tof view (that is, will the app run?) but also from the _legal_ point of view (am I obliged to distribute all those fonts?) And what about all thos .afm files? Are they needed? What are they really? I hope to find some answers from your experience. best Carlos -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] problem with MPL+py2exe (wx app needs qt?)
Hello all, I'm trying to build an executable distribution of an app I'm working using py2exe. After a lot of googling, I found what it seems to be a good combination of parameters, but when I try to run the .exe, it fails. The .log file shows me that the module backend_qt4agg wasn't found: ImportError: No module named backend_qt4agg Also, using py2exe -x shows me that PyQt4 is being imported by matplotlib.pyplot. The thing is, this is a WxPython application. Why is pyplot importing pyqt?? How do I stop it? thanks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with MPL+py2exe (wx app needs qt?)
Many thanks, that helper. After some more problems with scipy, I got a working EXE. PyQt4 is still in the library, though. Eating almost 15Mb... Now all I have to do is to find out how to remove it.. cheers Carlos On Mon, Sep 13, 2010 at 18:47, Goyo goyod...@gmail.com wrote: 2010/9/13 Carlos Grohmann carlos.grohm...@gmail.com: Hello all, I'm trying to build an executable distribution of an app I'm working using py2exe. After a lot of googling, I found what it seems to be a good combination of parameters, but when I try to run the .exe, it fails. The .log file shows me that the module backend_qt4agg wasn't found: ImportError: No module named backend_qt4agg Also, using py2exe -x shows me that PyQt4 is being imported by matplotlib.pyplot. The thing is, this is a WxPython application. Why is pyplot importing pyqt?? How do I stop it? Maybe it's specified in the matplotlib.rc. Make sure your intended backend is in use *before* you import pyplot: import matplotlib as mpl mpl.use('WXAgg') import pyplot as plt -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] exclude something from legend
Many thanks Tinne. That did it. On Thu, Aug 26, 2010 at 03:55, Tinne De Laet tinne.del...@mech.kuleuven.be wrote: Hi Carlos, On Thu, Aug 26, 2010 at 04:49, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hello all, Is there a way to tell MPL that something I plotted (like a series of Line2D, to create a grid) should not be considered for the legend? I'm plotting a lot of things, and because of these objects (without label), I always got these msgs: /usr/lib/pymodules/python2.6/matplotlib/axes.py:4014: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots. warnings.warn(No labeled objects found. I always use the following set of commands to get costumize my legend: ** legendEntries=[] # list of plots that are going to be in the legend legendText=[] # list of text messages for the legend thisPlot = plot(x,y,'b*') # a plot command legendEntries.append(thisPlot) # only do this for the plots you want to add to the legend legendText.append(legend text) # only this for the plots you want to add to the legend lgd = legend(legendEntries,legendText,numpoints=1,prop=props,loc='upper right') # example of how to draw the legend ** Hope this helps, Tinne -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] exclude something from legend
Hello all, Is there a way to tell MPL that something I plotted (like a series of Line2D, to create a grid) should not be considered for the legend? I'm plotting a lot of things, and because of these objects (without label), I always got these msgs: /usr/lib/pymodules/python2.6/matplotlib/axes.py:4014: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots. warnings.warn(No labeled objects found. Tks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] progress bar?
I've been searching but coudn't find any example on how to add a progress bar to a wxpython+matplotlib app. I'd like my app to show a progress bar while some gridding and contouring are being done. this is the code I'm using (without preogress bar) funcs = {Natural Neighbor:'nn', Triangulation:'linear',Multiquadric:'multiquadric',Inverse Multiquadric:'inverse multiquadric',Gaussian:'gaussian',Linear RBF:'linear',Cubic:'cubic',Quintic:'quintic',Thin-plate Spline:'thin-plate'} # check what kind of interpolation are we using if interp == 'Natural Neighbor' or interp == 'Triangulation': # Delaunay-based (mlab) xi = yi = np.linspace(-1.1,1.1,ngrid) zi = griddata(node_x,node_y,z,xi,yi,interp=funcs[interp]) else: # Radial basis functions (scipy) ti = np.linspace(-1.1,1.1,ngrid) xi, yi = np.meshgrid(ti, ti) rbf = Rbf(node_x, node_y, z, function=funcs[interp],epsilon=epsilon,smooth=smoothing) zi = rbf(xi, yi) ## we only want the points that lie inside the circle, ## so we have to create a polygon to select the interpolated values polyXY = [] u = np.arange(0,361,1) t = np.radians(u) x = np.cos(t) y = np.sin(t) polyXY.append(zip(x,y)) verts = np.array(polyXY) verts = verts[0] xyflat = zip(xi.flat,yi.flat) pmask = points_inside_poly(xyflat, verts) pmask2 = np.reshape(pmask,(ngrid,ngrid)) zmask = ma.masked_where(pmask2==False,zi) zi = zmask axes.contour(xi,yi,zi) TIA Carlos -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 Can’t stop the signal. -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] interpolate inside a circle
Thanks Fabrice. I can interpolate my data using rbf, but only inside a rectangular area (mesh). I'm looking into how to interpolate data inside a circular area, that is, disregarding anything outside a circle (or a polygon, like a convex hull) tks Carlos On Wed, May 26, 2010 at 09:29, Fabrice Silva si...@lma.cnrs-mrs.fr wrote: Le mardi 25 mai 2010 à 21:47 -0300, Carlos Grohmann a écrit : Dears, I want to interpolate some irregular data using radial basis. Can I interpolate only the data that falls inside a circle (or a polygon)? May these pages help you? http://www.scipy.org/Cookbook/RadialBasisFunctions http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.Rbf.html -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] interpolate inside a circle
Dears, I want to interpolate some irregular data using radial basis. Can I interpolate only the data that falls inside a circle (or a polygon)? TIA -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] linestyles in LineCollection
Hi there I found that the error is related to legend! If I disable self.plotaxes.legend(bbox_to_anchor=(0.95, 0.95), loc=2, prop=FontProperties(size='small'),numpoints=1) I can change the linestyles and it works like a charm, but if I turn on that line again... just errors. can anyone think of something? best Carlos On Wed, Apr 28, 2010 at 09:46, Michael Droettboom md...@stsci.edu wrote: I can't reproduce the error on 0.99. Can you provide a complete script that reproduces the error? Mike Carlos Grohmann wrote: I've been trying to change the linestyles in a LineCollection, but without any success... If I'm using: col = collections.LineCollection(listXY, linewidths=circwdt, colors=circcol, linestyle='solid', label=plabel) it works fine, but anything other than 'solid' gives me an error when the code calls FigureCanvasAgg.draw(self) (it is a wxpython app): Traceback (most recent call last): File /home/guano/Arbeit/Stout/StereoPanel.py, line 552, in PlotChecked self.stereoCanvas.draw() File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py, line 59, in draw FigureCanvasAgg.draw(self) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 314, in draw self.figure.draw(self.renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/figure.py, line 774, in draw for a in self.axes: a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/axes.py, line 1721, in draw a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/legend.py, line 386, in draw self._legend_box.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 488, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 535, in draw drawFunc(renderer, gc, tpath, affine.frozen()) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 874, in _draw_lines self._lineFunc(renderer, gc, path, trans) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 925, in _draw_dashed renderer.draw_path(gc, path, trans) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 98, in draw _path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number From the MPL docs, I see that i should be able to use other linestyles: http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection linestyles [ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ] a string or dash tuple. The dash tuple is: I'm using MPL 0.99.0 in Ubuntu Karmic (9.10) tks -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] linestyles in LineCollection
Here. I found out that if I use from pylab import * as in the example, it works. But in my app, I'm using import wx import matplotlib from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg from matplotlib.font_manager import fontManager, FontProperties from matplotlib.collections import LineCollection could that be the culprit? Carlos script: from pylab import * import numpy as np from matplotlib.collections import LineCollection # We need to set the plot limits, the will not autoscale ax = axes() ax.set_xlim((-1,1)) ax.set_ylim((-1,1)) strike = [0,45,90,135] dip = [10,20,30,40] listXY = [] for i in range(len(strike)): beta = np.radians(strike[i]) phi = np.radians(np.arange(-90,92,2)) lamb = np.radians((90 - dip[i])) alpha = np.arccos(np.cos(phi) * np.cos(lamb)) tq = np.sqrt(2) * np.sin(alpha/2) sint = np.sin(phi) / np.sin(alpha) temps = 1 - (sint * sint) x = tq * np.sqrt(temps) y = tq * sint x1 = np.cos(beta) * x + np.sin(beta) * y y1 = -np.sin(beta) * x + np.cos(beta) * y listXY.append(zip(x1,y1)) col = LineCollection(listXY, linewidths=1, colors='red', linestyles = 'dotted') ax.add_collection(col, autolim=True) show() On Wed, Apr 28, 2010 at 09:46, Michael Droettboom md...@stsci.edu wrote: I can't reproduce the error on 0.99. Can you provide a complete script that reproduces the error? Mike Carlos Grohmann wrote: I've been trying to change the linestyles in a LineCollection, but without any success... If I'm using: col = collections.LineCollection(listXY, linewidths=circwdt, colors=circcol, linestyle='solid', label=plabel) it works fine, but anything other than 'solid' gives me an error when the code calls FigureCanvasAgg.draw(self) (it is a wxpython app): Traceback (most recent call last): File /home/guano/Arbeit/Stout/StereoPanel.py, line 552, in PlotChecked self.stereoCanvas.draw() File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py, line 59, in draw FigureCanvasAgg.draw(self) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 314, in draw self.figure.draw(self.renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/figure.py, line 774, in draw for a in self.axes: a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/axes.py, line 1721, in draw a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/legend.py, line 386, in draw self._legend_box.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 488, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 535, in draw drawFunc(renderer, gc, tpath, affine.frozen()) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 874, in _draw_lines self._lineFunc(renderer, gc, path, trans) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 925, in _draw_dashed renderer.draw_path(gc, path, trans) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 98, in draw _path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number From the MPL docs, I see that i should be able to use other linestyles: http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection linestyles [ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ] a string or dash tuple. The dash tuple is: I'm using MPL 0.99.0 in Ubuntu Karmic (9.10) tks -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal
[Matplotlib-users] linestyles in LineCollection
I've been trying to change the linestyles in a LineCollection, but without any success... If I'm using: col = collections.LineCollection(listXY, linewidths=circwdt, colors=circcol, linestyle='solid', label=plabel) it works fine, but anything other than 'solid' gives me an error when the code calls FigureCanvasAgg.draw(self) (it is a wxpython app): Traceback (most recent call last): File /home/guano/Arbeit/Stout/StereoPanel.py, line 552, in PlotChecked self.stereoCanvas.draw() File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_wxagg.py, line 59, in draw FigureCanvasAgg.draw(self) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 314, in draw self.figure.draw(self.renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/figure.py, line 774, in draw for a in self.axes: a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/axes.py, line 1721, in draw a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/legend.py, line 386, in draw self._legend_box.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 224, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/offsetbox.py, line 488, in draw c.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 535, in draw drawFunc(renderer, gc, tpath, affine.frozen()) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 874, in _draw_lines self._lineFunc(renderer, gc, path, trans) File /usr/lib/pymodules/python2.6/matplotlib/lines.py, line 925, in _draw_dashed renderer.draw_path(gc, path, trans) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 98, in draw _path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number From the MPL docs, I see that i should be able to use other linestyles: http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection linestyles [ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ] a string or dash tuple. The dash tuple is: I'm using MPL 0.99.0 in Ubuntu Karmic (9.10) tks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend: symbols is duplicated
Many thanks! carlos On Thu, Apr 22, 2010 at 18:54, Gökhan Sever gokhanse...@gmail.com wrote: On Thu, Apr 22, 2010 at 4:44 PM, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hi all, I'm getting this weird behavior of legend. I always get two symbols in front of the labels, instead of one. Did anyone experienced this before? I'm working with MPL in a WxPython app. code snippet: [code] for i in range(len(self.idxPlan)): x = self.PeigenList[i][14] + (self.PeigenList[i][15] / 2) y = self.PeigenList[i][15] * sqrt3_2 axes.plot(x,y, self.PProps[i][3], c=self.PProps[i][2], ms=self.PProps[i][4],label=self.Pname[i]) axes.legend(bbox_to_anchor=(0.85, 0.75), loc=2, prop=FontProperties(size='small')) axes.set_xlim(-0.1,1.2) axes.set_ylim(-0.1,1.2) self.dataCanvas.draw() [\code] tks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. Hi, Try using numpoints keyword: plt.legend(numpoints=1) -- Gökhan -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] legend: symbols is duplicated
Hi all, I'm getting this weird behavior of legend. I always get two symbols in front of the labels, instead of one. Did anyone experienced this before? I'm working with MPL in a WxPython app. code snippet: [code] for i in range(len(self.idxPlan)): x = self.PeigenList[i][14] + (self.PeigenList[i][15] / 2) y = self.PeigenList[i][15] * sqrt3_2 axes.plot(x,y, self.PProps[i][3], c=self.PProps[i][2], ms=self.PProps[i][4],label=self.Pname[i]) axes.legend(bbox_to_anchor=(0.85, 0.75), loc=2, prop=FontProperties(size='small')) axes.set_xlim(-0.1,1.2) axes.set_ylim(-0.1,1.2) self.dataCanvas.draw() [\code] tks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] how to get the properties for elements in a collection?
Hi, I have a collection, which is a scatter plot, and I want to iterate through all the elements in this collection and retrieve their properties, like facecolor. the scatterplot is created like this: axes.scatter(x,y, c=some_list, cmap=plt.get_cmap(colmap)) many thanks -- Carlos Henrique Grohmann - Geologist D.Sc. a.k.a. Guano - Linux User #89721 ResearcherID: A-9030-2008 http://digitalelevation.blogspot.com http://www.igc.usp.br/pessoais/guano _ Can’t stop the signal. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users