Re: [Matplotlib-users] contour coordinates
Hi all, just a little question : how matplotlib computes contours? Is it based on an internal library? Is it possible to access it from outside? Thanks Le vendredi 30 janvier 2009 à 10:22 -0500, Eli Brosh a écrit : Hello again, I finally found the command I was looking for. It is the to_polygons(). Here is what worked : # make a LineCollection of contours col=contour(X,Y,Z,LevelsNumber).collections for i in np.arange(0,LevelsNumber,1): polygoni=col[i].get_paths()[0].to_polygons()[0] print polygoni All the vertices in each collections are extracted to the polygoni. Thanks again to Jeff and Patrick ! By the way, I found out that I do not actually need this procedure to achieve may goal which was to make a contour plot in ternary coordinates. Eli On Tue, Jan 27, 2009 at 11:08 PM, Patrick Marsh patrickmars...@gmail.com wrote: On Tue, Jan 27, 2009 at 7:16 PM, Eli Brosh ebro...@gmail.com wrote: Many thanks to Jeff and to Patric ! I will try to work along the line suggested by Jeff. Patric, please send me your code. I hope to learn from it. Thanks again, Eli Here is a template that can be used. I use this for meteorological models, but should work with any gridded file. import numpy as np from mpl_toolkits.basemap import Basemap f = (some gridded file) X = np.array(grab longitudes from f) Y = np.array(grab latitudes from f) field = np.array(grab field to be contoured from f) map = Basemap(make a Basemap call here) level = np.arange(minval, maxval, interval) col = map.contour(X, Y, field, level).collections for vertex in col[i].get_paths():# GET THE PATHS FOR THE EACH CONTOUR BY LOOPING THROUGH CONTOURS for vertex in xy.vertices: # ITERATE OVER THE PATH OBJECTS x, y = map(vertex[0],vertex[1],inverse=True) # vertex[0] and now 'x' is the longitude of the vertex and vertex[1] and now 'y' is the latitude of the vertex Let me know how this works. -Patrick On Tue, Jan 27, 2009 at 7:09 PM, Patrick Marsh patrickmars...@gmail.com wrote: On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker jsw...@fastmail.fm wrote: Eli Brosh wrote: Hello, I am trying to extract the coordinates of contour lines. I tried the following: cs = *contour*(Z) for lev, col in zip(cs.levels, cs.collections): s = col._segments that I found in a previous post (title contouring, by Jose Gómez-Dans-2 http://www.nabble.com/user/UserProfile.jtp?user=30071 Nov 30, 2007; 07:47am ) . I hoped that s will be a list of numpy arrays, each containing the (x,y) vertices defining a contour line at level lev. However, I got an error message: AttributeError: 'LineCollection' object has no attribute '_segments' How is it possible to get coordinates of the contours, similar to the MATLAB command [C,H] = *CONTOUR*(...) where the result in C is the coordinates of the contours. A similar question appeared in a post contour data (by Albert Swart http://www.nabble.com/user/UserProfile.jtp?user=382945 May 17, 2006; 09:42am) but I could not understand the answer. Is it possible to get more specific directions with a simple example ? Thanks Eli Eli: Calling get_paths() on each line collection in CS.collections will return a list of Path objects. From the Path objects, you can get a Nx2 array of vertices from the vertices attribute. There are no examples that I know of, but if you get it to do what you want to do, it would be great if you could contribute an example. As you noted, this question has come up several times before. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO,
Re: [Matplotlib-users] [matplotlib-devel] What would you like to see in a book about Matplotlib?
On Mon, Feb 02, 2009 at 03:47:32PM +, Chris Walker wrote: One of the things I liked about Gael's article was its discussion of threading - separating the gui from the calculations from the data acquisition. Thanks. Be aware that this is a rats nest, though, as threading is the best way to reveal all the subtleties of an event loop, and the various race conditions that you can have with it. The strong model/view separation that is implicit in Traits allows to hide the code making the view thread-safe in the Traits code updating implicitly the view. You can build these constraints in your multi-threaded application (I believe I touch a couple of words on this in my tutorial), but you have to be aware of the problems and the good patterns to answer them. To sum up, I am not saying this is uninteresting, on the contrary, I am just saying that such text is hard to write (which makes a good text even more interesting). My 2 cents, Gaël -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Strange Recursion error with plot()
Hi, I'm using matplotlib on Ubuntu Jaunty and a script that I wrote recently stopped working. I think this may have something to do with changes in matplotlib as it fails with the error pasted at http://pastebin.ca/1325576 and the main problem is that I can't actually work out what the error is because it just recurses until python stops it. I don't think this is a fault of my script so it might be a bug with matplotlib but I'm really not sure... The matplotlib version is 0.98.5.2-1 but I'm not sure that that will help. Numpy version is 1:1.1.1-2 and Python is 2.5.4. If I need to add more details, please ask. Thanks. -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange Recursion error with plot()
On Mon, 02 Feb 2009 19:30:58 -, Darren Dale dsdal...@gmail.com wrote: Hmm... I was passing strings! That is really weird because it used to work when I just passed strings and I have no idea why. I guess I should have converted to numbers right from the beginning. Anyway, I've fixed it by using int and float convertors! Did something change with matplotlib recently? I normally use the right types and it had been working for about 6 months with string types. Thanks a lot! On Mon, Feb 2, 2009 at 2:17 PM, Durand dura...@gmail.com wrote: Hi, I'm using matplotlib on Ubuntu Jaunty and a script that I wrote recently stopped working. I think this may have something to do with changes in matplotlib as it fails with the error pasted at http://pastebin.ca/1325576and the main problem is that I can't actually work out what the error is because it just recurses until python stops it. I don't think this is a fault of my script so it might be a bug with matplotlib but I'm really not sure... The matplotlib version is 0.98.5.2-1 but I'm not sure that that will help. Numpy version is 1:1.1.1-2 and Python is 2.5.4. If I need to add more details, please ask. It would help to know what exactly you are passing to plot(). I suspect that you are passing strings at some point where you should be passing numbers. Darren -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange Recursion error with plot()
This is fixed in SVN head now so that strings will work again (though I wouldn't exactly say that this is supported.) Durand wrote: On Mon, 02 Feb 2009 19:30:58 -, Darren Dale dsdal...@gmail.com wrote: Oh and thinking about it, I think matplotlib needs a better error message. Maybe something will less recursions =] Thanks again. On Mon, Feb 2, 2009 at 2:17 PM, Durand dura...@gmail.com wrote: Hi, I'm using matplotlib on Ubuntu Jaunty and a script that I wrote recently stopped working. I think this may have something to do with changes in matplotlib as it fails with the error pasted at http://pastebin.ca/1325576and the main problem is that I can't actually work out what the error is because it just recurses until python stops it. I don't think this is a fault of my script so it might be a bug with matplotlib but I'm really not sure... The matplotlib version is 0.98.5.2-1 but I'm not sure that that will help. Numpy version is 1:1.1.1-2 and Python is 2.5.4. If I need to add more details, please ask. It would help to know what exactly you are passing to plot(). I suspect that you are passing strings at some point where you should be passing numbers. Darren -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange Recursion error with plot()
On Mon, 02 Feb 2009 19:57:15 -, Ryan May rma...@gmail.com wrote: I think it makes sense to accept only numbers but I suppose it's needed for backwards compatibility. Maybe you could have a deprecation warning? This is fixed in SVN head now so that strings will work again (though I wouldn't exactly say that this is supported.) Durand wrote: On Mon, 02 Feb 2009 19:30:58 -, Darren Dale dsdal...@gmail.com wrote: Oh and thinking about it, I think matplotlib needs a better error message. Maybe something will less recursions =] Thanks again. ... -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] datetutil issues
On Mon, Feb 2, 2009 at 20:29, C M cmpyt...@gmail.com wrote: I'm doing some date plotting and make use of dateutil. The version I have is given as 1.2-mpl and I believe it installed directly with the latest matplotlib installation. My problem is with dateutil's microsecond precision. An example: date = '2009-01-11 03:55:23.255000' d = dateutil.parser.parse(date) d datetime.datetime(2009, 1, 11, 3, 55, 23, 254999) Note the microseconds of the datetime object are 254999, whereas the original date string given was 255000. This matters to me in that I am matching to a database and would prefer to have the two values just match without further manipulation. I thought maybe newer versions of dateutil would have had this issue worked out. I see there is a dateutil 1.4.1 available, here: http://labix.org/python-dateutil Yes it's fixed: $ python Python 2.5.2 (r252:60911, Jan 4 2009, 21:59:32) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. import dateutil.parser dateutil.__version__ '1.4.1' date = '2009-01-11 03:55:23.255000' d = dateutil.parser.parse(date) d datetime.datetime(2009, 1, 11, 3, 55, 23, 255000) Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange Recursion error with plot()
Durand wrote: On Mon, 02 Feb 2009 19:57:15 -, Ryan May rma...@gmail.com wrote: I think it makes sense to accept only numbers but I suppose it's needed for backwards compatibility. Maybe you could have a deprecation warning? This is fixed in SVN head now so that strings will work again (though I wouldn't exactly say that this is supported.) Durand wrote: On Mon, 02 Feb 2009 19:30:58 -, Darren Dale dsdal...@gmail.com wrote: Oh and thinking about it, I think matplotlib needs a better error message. Maybe something will less recursions =] I'd call it an implementation specific detail. Since it's not advertised as a feature, I don't feel bad if it goes away in the future by changing the implementation. The purpose of 'fixing' it was only to eliminate the infinite recursion. :) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] datetutil issues
On Mon, Feb 2, 2009 at 21:18, C M cmpyt...@gmail.com wrote: OK, great. How do I get 1.4.1? you say nothing about your operating system, so how can you expect us to help? I use Debian, and the package it's there, try find it in your distribution, if not install setuptools (since it needs that module too, from your error) and then dateutils. Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange Recursion error with plot()
On Mon, Feb 2, 2009 at 2:17 PM, Durand dura...@gmail.com wrote: Hi, I'm using matplotlib on Ubuntu Jaunty and a script that I wrote recently stopped working. I think this may have something to do with changes in matplotlib as it fails with the error pasted at http://pastebin.ca/1325576and the main problem is that I can't actually work out what the error is because it just recurses until python stops it. I don't think this is a fault of my script so it might be a bug with matplotlib but I'm really not sure... The matplotlib version is 0.98.5.2-1 but I'm not sure that that will help. Numpy version is 1:1.1.1-2 and Python is 2.5.4. If I need to add more details, please ask. It would help to know what exactly you are passing to plot(). I suspect that you are passing strings at some point where you should be passing numbers. Darren -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange Recursion error with plot()
On Mon, 02 Feb 2009 20:17:06 -, Ryan May rma...@gmail.com wrote: Fair enough I suppose. I'm not really sure where I got the string input idea from anyway.. Durand wrote: On Mon, 02 Feb 2009 19:57:15 -, Ryan May rma...@gmail.com wrote: I think it makes sense to accept only numbers but I suppose it's needed for backwards compatibility. Maybe you could have a deprecation warning? This is fixed in SVN head now so that strings will work again (though I wouldn't exactly say that this is supported.) Durand wrote: On Mon, 02 Feb 2009 19:30:58 -, Darren Dale dsdal...@gmail.com wrote: Oh and thinking about it, I think matplotlib needs a better error message. Maybe something will less recursions =] I'd call it an implementation specific detail. Since it's not advertised as a feature, I don't feel bad if it goes away in the future by changing the implementation. The purpose of 'fixing' it was only to eliminate the infinite recursion. :) Ryan -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] x-axis line in bar plots
Hi, I am creating a bar graph which contains negative values on y-axis. Everything is fine, but there is no line corresponding to y=0, so the bars seem a bit weird. Here is a short example- x = range(10) y = [random.randint(-10, 10) for i in x] bar(x, y) What I want is a line to be drawn at y=0. Any idea how to get it done? Apologies if this has been asked before. I searched but couldn't find a way. Thanks, Ram -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] x-axis line in bar plots
Ramashish Baranwal ramashish.li...@gmail.com writes: x = range(10) y = [random.randint(-10, 10) for i in x] bar(x, y) What I want is a line to be drawn at y=0. Any idea how to get it done? How about axhline: axhline(color='k', lw=1) See the documentation of axhline (and hlines) for more. -- Jouni K. Seppänen http://www.iki.fi/jks -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] What would you like to see in a book about Matplotlib?
On Sun, Feb 01, 2009 at 11:59:06PM +0100, Sandro Tosi wrote: Hi Chris, thanks for your reply, helpful as usual :) On Fri, Jan 30, 2009 at 18:59, Chris Walker chr...@chiark.greenend.org.uk wrote: Firstly, good luck with the book. cheers :) The sort of book I'd buy would explain how to use the combination of matplotlib/ipython/scipy/numpy to analyse data. Sadly, that would not the book I'll write :( The editor wanted to target another audience for the book: experienced python developers, with no knowledge of matplotlib; so an introductionary book, that will show even how to integrate mpl on GTK/WX application and on the web. I pushed to have something about science, and a chapter will be about that, but I need your (all) inputs, because my science days are long back in the past ;) Sure - though anyone wanting to use matplotlib is likely to be acquiring, manipulating and then plotting data. - what are the (basic) things that, when you were beginning to use matplotlib, you wanted to see grouped up but couldn't find? - what would you like to see in a book about matplotlib? Start off by reading data from a file, plotting it and fitting a function to that data. That sounds something that could land in the science chapter. Indeed. Plotting with related scales Sometimes it is useful to plot related scales on x1 and x2 axes. I've come across this several times in different contexts. In its simplest form, there is a linear relationship between the axes. In a mechanical test, you might want extension on the x1 axis and strain on the x2 axis (for example). Sometimes there is not a linear relationship. For example you might want to plot frequency (or photon energy) on x1 and wavelength on x2. An even more complex example is a Hall-Petch plot: (Yield Stress) = k/sqrt(Grain Size) So plotting 1/Sqrt(Grain Size) on the X1 axis gives a linear plot, but it would be useful to plot the grain size on the X2 scale. Err, I think I lost you ;) Figure 3b/3c at http://dcwww.camd.dtu.dk/~schiotz/papers/risoesymp/html/node3.html is an example - note that the y2 scale is not linear. What you want is 2 plots on the same figure? so not 2 Ys for the same X 2 scales on the same figure, yes. (let's say X is time, and Y1 is stock price variation, and Y2 is the percentage change), you want X1-Y1 (let's say on the bottom-left) and X2-Y2 (on the upper-right): did I get you? Exactly. http://en.wikipedia.org/wiki/File:Body_mass_index_chart.svg is the sort of thing I had in mind. ipython and emacs - Suppose I want to write a script to analyse some data (perhaps I want a record of what I've done, or perhaps I'd like to perform the same analysis on several data sets). I'd probably do so in emacs - but it is useful to do some experimentation in ipython - tab completion is particularly useful. I feel there must be a good way to do my experimentation in ipython and save the important bits in emacs - but I've not sat down and worked out an efficient way of doing this. I think the preferred way to do so it using ipython, and for now I plan only to show it on the book. Whether or not this make it into the book, I'm interested in how people do this. Surely you don't write your application using just ipython do you? Data aqcuisition and experimental control: - Writing a simple application to acquire data - ideally from multiple sources and plot the data as it is acquired. In my case I wanted to combine mechanical with electrical tests. A couple of interesting articles by G Varoquaux are listed at http://wiki.debian.org/DebianScience/DataAcquisition This is perhaps beyond the scope of the book, but it has come up on the mailing lists a couple of times. The ideal application would have a gui for simple use, but a command line (probably ipython) for more more complex use - perhaps performing a series of tests under different conditions. I thought about an example for this already! :) Excellent. I thought to develop a sample application for GTK/WX that display some system value (like cpu usage or so, in this way everyone can run the example) plotting the information as it comes (for 30 secs, for example). One of the things I liked about Gael's article was its discussion of threading - separating the gui from the calculations from the data acquisition. Some discussion of plotting non gridded 2d data should also be in there. for example? Something like: http://matplotlib.sourceforge.net/examples/pylab_examples/griddata_demo.html It is something I have encountered several times. Another example I had in mind is: http://www.sci.muni.cz/~mikulik/gallery.html#GaAlAsFishAtPM http://www.sci.muni.cz/~mikulik/gnuplot.html I've taken similar measurements in the past - and one often takes
[Matplotlib-users] Polar plot with y-lim set to non-zero
Hi All - is there any way to make a polar plot with the center of the plot *not* set to 0? I tried resetting ylim, but that just changes the grid laid over the plot, not the location of the markers. Thanks -- Ariel -- Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour coordinates
matplotlib uses some C-based contouring code that began life in GIST. You can see it here: http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/src/cntr.c?revision=5781view=markup It has some limitations, notably around certain donut-shaped contours, and a number of us have made attempts to improve it or replace it with something else suitably licensed, but that's the best we've been able to do for now. Mike Lionel Roubeyrie wrote: Hi all, just a little question : how matplotlib computes contours? Is it based on an internal library? Is it possible to access it from outside? Thanks Le vendredi 30 janvier 2009 à 10:22 -0500, Eli Brosh a écrit : Hello again, I finally found the command I was looking for. It is the to_polygons(). Here is what worked : # make a LineCollection of contours col=contour(X,Y,Z,LevelsNumber).collections for i in np.arange(0,LevelsNumber,1): polygoni=col[i].get_paths()[0].to_polygons()[0] print polygoni All the vertices in each collections are extracted to the polygoni. Thanks again to Jeff and Patrick ! By the way, I found out that I do not actually need this procedure to achieve may goal which was to make a contour plot in ternary coordinates. Eli On Tue, Jan 27, 2009 at 11:08 PM, Patrick Marsh patrickmars...@gmail.com wrote: On Tue, Jan 27, 2009 at 7:16 PM, Eli Brosh ebro...@gmail.com wrote: Many thanks to Jeff and to Patric ! I will try to work along the line suggested by Jeff. Patric, please send me your code. I hope to learn from it. Thanks again, Eli Here is a template that can be used. I use this for meteorological models, but should work with any gridded file. import numpy as np from mpl_toolkits.basemap import Basemap f = (some gridded file) X = np.array(grab longitudes from f) Y = np.array(grab latitudes from f) field = np.array(grab field to be contoured from f) map = Basemap(make a Basemap call here) level = np.arange(minval, maxval, interval) col = map.contour(X, Y, field, level).collections for vertex in col[i].get_paths():# GET THE PATHS FOR THE EACH CONTOUR BY LOOPING THROUGH CONTOURS for vertex in xy.vertices: # ITERATE OVER THE PATH OBJECTS x, y = map(vertex[0],vertex[1],inverse=True) # vertex[0] and now 'x' is the longitude of the vertex and vertex[1] and now 'y' is the latitude of the vertex Let me know how this works. -Patrick On Tue, Jan 27, 2009 at 7:09 PM, Patrick Marsh patrickmars...@gmail.com wrote: On Tue, Jan 27, 2009 at 5:33 PM, Jeff Whitaker jsw...@fastmail.fm wrote: Eli Brosh wrote: Hello, I am trying to extract the coordinates of contour lines. I tried the following: cs = *contour*(Z) for lev, col in zip(cs.levels, cs.collections): s = col._segments that I found in a previous post (title contouring, by Jose Gómez-Dans-2 http://www.nabble.com/user/UserProfile.jtp?user=30071 Nov 30, 2007; 07:47am ) . I hoped that s will be a list of numpy arrays, each containing the (x,y) vertices defining a contour line at level lev. However, I got an error message: AttributeError: 'LineCollection' object has no attribute '_segments' How is it possible to get coordinates of the contours, similar to the MATLAB command [C,H] = *CONTOUR*(...) where the result in C is the coordinates of the contours. A similar question appeared in a post contour data (by Albert Swart http://www.nabble.com/user/UserProfile.jtp?user=382945 May 17, 2006; 09:42am) but I could not understand the answer. Is it possible to get more specific directions with a simple example ? Thanks Eli Eli: Calling get_paths() on each line collection in CS.collections will return a list of Path objects. From the Path objects, you can get a Nx2 array of vertices from the vertices attribute. There are no examples that I know of, but if you get it to do what you want to do, it would be great if you could contribute
Re: [Matplotlib-users] datetutil issues
My problem is with dateutil's microsecond precision. An example: date = '2009-01-11 03:55:23.255000' d = dateutil.parser.parse(date) d datetime.datetime(2009, 1, 11, 3, 55, 23, 254999) Note the microseconds of the datetime object are 254999, whereas the original date string given was 255000. Just in case anyone is curios, this is a classic binary floating point issue: the 23.255 is being interpreted as floating point seconds, rather than as integer seconds and microseconds. 23.255 can not be exactly represented in binary floating point: s = 23.255000 s 23.254 s - int(s) 0.25401 I suspect dateutils is fixed by either parsing out the seconds, or adding a round() to the above: s = 23.255 seconds = int(s) microseconds = int(round((s-seconds)*1e6)) seconds, microseconds (23, 255000) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] datetutil issues
I'm doing some date plotting and make use of dateutil. The version I have is given as 1.2-mpl and I believe it installed directly with the latest matplotlib installation. My problem is with dateutil's microsecond precision. An example: date = '2009-01-11 03:55:23.255000' d = dateutil.parser.parse(date) d datetime.datetime(2009, 1, 11, 3, 55, 23, 254999) Note the microseconds of the datetime object are 254999, whereas the original date string given was 255000. This matters to me in that I am matching to a database and would prefer to have the two values just match without further manipulation. I thought maybe newer versions of dateutil would have had this issue worked out. I see there is a dateutil 1.4.1 available, here: http://labix.org/python-dateutil But I can't seem to install it. If I go into its downloaded directory and in the Win command line write python setup.py install it complains No module named setuptools. (I can usually install things in this way fine). Can anyone help me out? And can matplotlib include the more updated version of dateutil in its future releases? Thanks, Che -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] scatterhist matlab equivalent
hello, is there a way to make a 2d scatter plot that includes (outside the axes) histograms of the marginals of the two variables? like the matlab function 'scatterhist'. see this for an example: http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/scatterhist.html ideally i'd like the histograms outside the scatter plot to also have axes so that the height of each histogram bar will be interpretable. thank you -- Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] x-axis line in bar plots
x = range(10) y = [random.randint(-10, 10) for i in x] bar(x, y) What I want is a line to be drawn at y=0. Any idea how to get it done? How about axhline: axhline(color='k', lw=1) See the documentation of axhline (and hlines) for more. Thanks Jouni! This is exactly what I was looking for.:) Ram -- Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users