Re: [Matplotlib-users] Tutorial on perceptual colormaps
On Mon, Aug 4, 2014 at 5:20 PM, Matteo Niccoli mat...@mycarta.ca wrote: Hi All I recently wrote a tutorial on how to evaluate and compare colormaps using perceptual principle. It is geared towards Matplotlib. http://nbviewer.ipython.org/github/mycarta/tutorials/blob/master/1408_Evaluate_and_compare_colormaps/How_to_evaluate_and_compare_colormaps.ipynb Although I am a newbie and some of my code may be not all that pythonic yet, I hope you enjoy the read. Any feedback would be welcome. THank you Matteo Hi Matteo, Thanks for sharing this resource. Also, I wanted to personally thank you for MyCarta. It's a great resource and Kristen Thyng and I have learned a lot from it. Kristen cited you in a talk she gave at SciPy 2014 last month. We both gave talks at SciPy 2014 about colour maps I think you might find interesting. They were recorded and put on YouTube by Enthought and you can check them out herehttps://www.youtube.com/watch?v=Alnc9E1RnD8 and herehttps://www.youtube.com/watch?v=rkDgBvT-giw. I think it would be a good idea to link to your IPython (read Jupyter) notebook, along with some of the work Kristen as done with matplotlib colour maps, from the matplotlib web page. Would you be amenable to this? All the best, Damon -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Matplotlib hangout today
The matplotlib calendar claims there is a hangout today, but I can't find an invite on Google+. Am I missing something or was it cancelled? -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- DreamFactory - Open Source REST JSON Services for HTML5 Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Reports from SciPy 2013
On Tue, Jul 2, 2013 at 11:57 PM, Nelle Varoquaux nelle.varoqu...@gmail.comwrote: On 2 July 2013 16:33, Anthony Scopatz scop...@gmail.com wrote: On Tue, Jul 2, 2013 at 9:04 AM, Jason Grout jason-s...@creativetrax.com wrote: On 7/1/13 9:33 AM, Michael Droettboom wrote: SciPy 2013 was a great success. I didn't get good headcount at the matplotlib BOF, but it was a good number, and we had 15 participants at various points during the sprints. It was nice to see the diversity of experience with matplotlib at the sprints, and I hope we oldtimers were helpful to the newtimers getting started so they can continue to contribute in the future. It was also great to put some faces to many of the talented names I've been seeing on github and the mailing list lately. On a slightly different, but related topic: is there any chance the entries (or at least the winning entries) to the plotting contest could be posted online? Yes, We'll put try to put these on the conference website at the very least. We also talked about adding this to the matplotlib website, but we need to sort out first the copyright problems and then coding this part of the website. +1 -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is there a 3D version of the quiver plot?
On Thu, Mar 7, 2013 at 5:32 PM, Brickle Macho bricklema...@gmail.com wrote: Thanks. I had a quick read of the thread linked, if I was a stronger/better programmer I would see if I could contribute. For now I plan calculate/plot the angle between the normal and each the X,Y,Z planes. I hopefully the 3 subplots will visually convey sufficient information. Correct me if I'm wrong, but would a 2D quiver plot on top of a contour plot work? What spaces does the surface map to/from? If your surface can be expressed as a function f:R^2 - R then it's equivalent to look at its level sets, rather than the 3D picture. You can then project the surface normals onto the plane and plot them with a 2D quiver plot. If you want to keep the z-component information, then you could colour the arrows according to the angle they make with the x-y plane. Does that make sense? I put the original feature request in, and I think it would be useful, but often I still find it easier to process two dimensional information. N.B. The above will only work for *functions* f:R^2 - R. To clarify, a sphere cannot be expressed this way, because the resulting mapping would be multivalued. Using this method, two distinct surface normals may have the same colour. Hope that makes sense. Best wishes, Damon Brickle. -- On 8/03/13 5:43 AM, Benjamin Root wrote: On Thu, Mar 7, 2013 at 4:25 PM, Eric Firing efir...@hawaii.edu wrote: On 2013/03/07 9:19 AM, Benjamin Root wrote: On Thu, Mar 7, 2013 at 2:14 PM, Brickle Macho bricklema...@gmail.com mailto:bricklema...@gmail.com wrote: I have a list of surface normals I would like to plot. Is there a way to plot a 3D vectors in matplotlib similar to how quiver plots 2D vectors? Not at this time, but that would make a great feature request! I think the current roadblock to such a function is a bug with converting 2d arrow objects into 3d arrows. Quiver uses a PolyCollection, and I see that there is a Poly3DCollection. Eric Ben Root Took a bit of digging, but I knew I remembered this question before: http://www.google.com/url?sa=trct=jq=esrc=ssource=webcd=1cad=rjaved=0CDMQFjAAurl=http%3A%2F%2Fmatplotlib.1069221.n5.nabble.com%2F2D-Quiver-in-Axes3D-td27944.htmlei=Pwk5UfGdLufv0QHuroD4BAusg=AFQjCNEqlWv2vY5l2IPcje-g6B0U21wDNwbvm=bv.43287494,d.dmQ And the feature request is here: https://github.com/matplotlib/matplotlib/issues/1026 In the thread I pointed out a bug that I encountered. I really hope I get some free time soon so that I can work on the various feature requests in mplot3d. Cheers! Ben Root -- Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] Matplotlib in daily life
On Mon, Jan 21, 2013 at 11:44 AM, Ryan May rma...@gmail.com wrote: Hi, Just ran across this article that shows a familiar looking graph. Just another encounter of matplotlib in daily life. http://www.wired.com/wiredenterprise/2013/01/google-password/2/ Here's another one, too: http://www.wired.com/wiredscience/2013/01/why-are-lego-sets-expensive/ Maybe the next wired article will use the SVG backend :) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ___ Matplotlib-devel mailing list matplotlib-de...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Undocumented transform API change between 1.1 and 1.2?
On Mon, Dec 10, 2012 at 6:27 PM, Joe Kington joferking...@gmail.com wrote: On Mon, Dec 10, 2012 at 2:45 AM, Phil Elson pelson@gmail.com wrote: Hi Joe, Thanks for bringing this up, it is certainly valuable to highlight this on the mailinglist. As you say, the change is hard to spot and, I agree, makes library code supporting v1.1.1 and v1.2 harder than one would like. Typically, anything which is going to break core APIs (even slightly) should be documented under the API Changes page here http://matplotlib.org/api/api_changes.html#changes-in-1-2-x . Thanks! I wasn't aware of that page! (and it does a very nice job of documenting the changes!) You will find there were quite a few changes made relating to transforms which I think is entirely my doing, so at least we know who the guilty party is :-) Thanks for spotting the example failure - I split these changes over many separate pull requests and did scan the gallery for any noticeable changes, but this one must have slipped the net. If you're still having problems with using the newer transform API, please shout and I'd be happy to have a look for you. Will do, thanks for the offer! All the best, Phil On 9 December 2012 22:10, Joe Kington joferking...@gmail.com wrote: Hi folks, At some point transforms.Transform was slightly refactored. (Particularly, this commit: https://github.com/matplotlib/matplotlib/commit/8bbe2e55f29b28ba558504b27596b8e36a087c1c ) This changed what methods need to be overridden when subclassing Transform. All in all, it seems like a very sensible change, but it led to some very hard-to-find bugs in some of my code that subclasses transforms.Transform. I thought I would mention it on the mailing list for anyone else that uses custom projections. Forgive me if it was mentioned earlier and I just didn't notice. With versions 1.1.x and older, one had to directly implement a transform method when subclassing transforms.Transform, otherwise a NotImplemented error would be raised. With versions 1.2.x and newer, the preferred way appears to be to implement things in a separate transform_affine or transform_non_affine method and not explicitly implement a transform method. If you implement the non-affine portion directly in the transform method without overriding transform_non_affine, it leads to strange drawing bugs with v1.2 that did not occur with older versions. (For example, this broke one of the examples in the gallery between 1.1. and 1.2: http://matplotlib.org/1.1.1/examples/api/custom_projection_example.html http://matplotlib.org/1.2.0/examples/api/custom_projection_example.html . I just submitted a pull request to update the example, by the way.) On the other hand, for compatibility with versions 1.1 and older, you have to explicitly implement the transform method as well, otherwise you'll get the NotImplemented error. Therefore, now one needs to explicitly implement _both_ the transform_non_affine and transform methods of a custom non-affine transform for compatibility with 1.1 and older as well as 1.2 and newer. Similarly, one needs to implement _both_ the transform_path_non_affine and the transform_path methods for compatibility with newer and older versions of matplotlib. Arguably, it should have always been done this way, but based on examples/api/custom_projection_example.py, I (and I suspect many other people as well) implemented the transform directly as the transform method when subclassing Transform, instead of separately in a transform_affine or transform_non_affine method. Is this a large enough change to warrant a mention in the changelog? (On the other hand, the mailing list probably gets a lot more eyes on it than the changelog...) Thanks! -Joe -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Is there anything we could do to give this important information a little more visibility on the webpage? The webpage still indicates that 1.2.0 is a development version. Perhaps we could update it to say: 1.2.0 The most current stable release. Click here to see what's new since 1.1.1 And have Click here link to the page Phil mentioned. Thoughts? -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- LogMeIn
Re: [Matplotlib-users] plot_surface does not work
On Tue, Dec 11, 2012 at 1:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Dec 11, 2012 at 2:08 PM, Chloe Lewis chle...@berkeley.edu wrote: Would it be workable for the default to be proportional to the size of the array passed in? (suggested only because I do that myself, when deciding how coarse an investigative plot I can get away with.) C That is pretty much what the PR I was referring to does: https://github.com/matplotlib/matplotlib/pull/1040 It makes it so that the behavior of both plot_surface and plot_wireframe is the same in this respect. So, by default, the rstride and cstride would be 1% of the size of your data array. This would make the default for the recent example be 1, therefore showing every point. I wonder if a logarithmic default would make sense to better handle large data arrays? Thoughts? Ben Root I hope nobody minds if I chime in here. I'm in favour of making the defaults a little more intelligent that what is implemented at present, i.e, a constant stride for any surface. Any non-trivial scaling law to determine what stride to use will result in more expected behaviour than what our users are currently seeing. Could we do better? Could we have plot_surface try and estimate the stride based on the 'roughness' of the surface to be plotted? This method would grind to a halt for very rough surfaces, so we could default to a scaling law in these cases. What does everyone think about this approach? -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to reverse the colorbar and its label at the same time?
On Sat, Nov 10, 2012 at 9:41 AM, Paul Hobson pmhob...@gmail.com wrote: On Sat, Nov 10, 2012 at 7:07 AM, Chao YUE chaoyue...@gmail.com wrote: Dear all, Is there a way to reverse the colorbar label, the default is small value at the bottom and big value at the top, yet I would like the big value at the bottom and small value at the top. all code in pylab mode. import numpy as np import matplotlib as mat a = np.arange(100).reshape(10,10) contourf(a,levels=np.arange(0,101,10)) colorbar() in the above figure, colorbar label shows 0 at the bottom and 100 at the top. Yet I want the 0 at the top and the 100 at the bottom, with the same sequence of colors in the colorbar. One way is to reverse the cmap, and then reverse the colorbar labels at the same time: a = np.arange(100).reshape(10,10) contourf(a,levels=np.arange(0,101,10),cmap=mat.cm.jet_r) cbar = colorbar() cbar.set_ticks(np.arange(0,101,10)) cbar.set_ticklabels(np.arange(100,-1,-10)) Chao, I think it's as simple as: import numpy as np import matplotlib.pyplot as plt a = np.arange(100).reshape(10,10) fig, ax1 = plt.subplots() CS = ax1.contourf(a,levels=np.arange(0,101,10)) cbar = plt.colorbar(CS) cbar.ax.invert_yaxis() Does that produce the desired results? -p Or, you could plot -a instead of a. -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot data from file while is file is constantly updated
On Thursday, November 8, 2012, Alejandro Weinstein wrote: If you are in a Linux machine, you can use `inotify`: Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem. It seems that there are a few option to use this from Python: http://pyinotify.sourceforge.net/ http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/ Alejandro. On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode sebrh...@gmail.comjavascript:; wrote: Hi, I have a textfile where every second a line is written. Usually the look like this: 1; 124; 455 a second later 1; 124; 455 2; 104; 600 ... Finally such a file is quite easy to plot using matplotlib. But what would be very useful for me is a script, that is watching the TXT file and updates the plot when a new row arrives. Any good ideas? Cheers, Sebi -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net javascript:; https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net javascript:; https://lists.sourceforge.net/lists/listinfo/matplotlib-users In bash: watch -n1 tail file.txt -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] Delaying rc3 (again)
On Tuesday, October 30, 2012, Russell E. Owen wrote: In article 508ff830.3050...@stsci.edu javascript:;, Michael Droettboom md...@stsci.edu javascript:; wrote: Agreed! Thanks to everyone for their hard work. I think this has shaped up to be a great release. I'm fortunate to have power and connectivity today, so I was able to get a release tested, tagged and uploaded. To our binary builders: as able, it would be great to put the binaries up (or send them to me to do so), and then I'll make an announcement on matplotlib-users. I really intend (barring any really serious issues) this to be the last rc before the 1.2.0 final. Thanks again, Mike The Mac binaries are now up. This time it built perfectly on MacOS X 10.4; thanks to the folks that worked so hard fixing those build problems. The 32-bit version is not well tested because I have neither inkscape nor ghostscript installed on that ancient system, but it passes the tests that it can run under those circumstances. The 64-bit version passes all tests except 2 knownfail and 3 skipped. -- Russell P.S. I had to build the 64-bit version twice. The first time I tried to build it using the same directory of code that I used to build 32-bit version. I first deleted the build and dist subdirectories and ran python setup.py clean, then built as usual. There were no errors or warnings during the build, but the unit tests would not run on the results -- complaining of missing modules. So I built again using a freshly unpacked code directory and that worked just fine. I'm pretty sure I've seen this problem before, but keep forgetting to ask about it. Is this a bug somewhere (e.g. in matplotlib's setup.py or somewhere in python) or is there some better way to clear out a python code directory? Yes! I'm sending you a virtual high five! Thanks for thy Russell. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram with overlapping bins
On Sat, Oct 20, 2012 at 10:25 PM, Steven Boada bo...@physics.tamu.edu wrote: It'd be cool if we could do something like bins = [(0.0,0.05,0.1),(0.05,0.1,0.15)...] Where I have specified the left edge, center and right edge of each bin. Yeah, that'd be pretty slick. S On Sat Oct 20 16:21:41 2012, Steven Boada wrote: Let's say I generate a bunch of random numbers from 0-1. Then, I'd like to make a histogram of it. But here's the clincher. I'd like my bins to overlap a bit. For example, if the first bin is from 0 - 0.1, centered on 0.05, I'd like the next (second) bin to be centered on 0.1 and range from 0.05 - 0.15. So basically, I want the width of each bin to be greater than the spacing. Is this something that could be done with the histogram function? I did a couple of google searches and couldn't come up with anything meaningful. Apparently, 'rwidth' in the hist function just makes the displayed bars bigger or smaller. Any thoughts? -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu My thoughts are that this goes against everything a histogram is set out to do; attempt to provide a 'discretised' probability distribution function given a set of discrete samples. Lets say a sample lies in the region where two bins overlap. How do you define which bin the sample lies in? Both? If both, how do you define the value of the approximated probability distribution on a bin? You could just take the height of the bin, but some of the bin's mass lies in each of the neighbouring bins. If you don't want to apply mass to the neighbouring bins for a sample that lies in the region where two bins overlap, you could just pick one. You then have the problem of non-uniqueness. If you'd picked the other bin you'd have a different probability distribution function. This a bad property to have. If you don't want to pick a neighbouring bin to apply more mass, and just increase the width of the each bin's matplotlib.patches.Patch object, then that is more sensible. Except now you have the problem of displaying the histogram. Which bin gets displayed over its left neighbour? And its right neighbour? I dread to think what this would imply if you also wanted to stack such histograms. A potential can of worms. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram with overlapping bins
On Sat, Oct 20, 2012 at 11:37 PM, Benjamin Root ben.r...@ou.edu wrote: On Saturday, October 20, 2012, Damon McDougall wrote: On Sat, Oct 20, 2012 at 10:25 PM, Steven Boada bo...@physics.tamu.edu wrote: It'd be cool if we could do something like bins = [(0.0,0.05,0.1),(0.05,0.1,0.15)...] Where I have specified the left edge, center and right edge of each bin. Yeah, that'd be pretty slick. S On Sat Oct 20 16:21:41 2012, Steven Boada wrote: Let's say I generate a bunch of random numbers from 0-1. Then, I'd like to make a histogram of it. But here's the clincher. I'd like my bins to overlap a bit. For example, if the first bin is from 0 - 0.1, centered on 0.05, I'd like the next (second) bin to be centered on 0.1 and range from 0.05 - 0.15. So basically, I want the width of each bin to be greater than the spacing. Is this something that could be done with the histogram function? I did a couple of google searches and couldn't come up with anything meaningful. Apparently, 'rwidth' in the hist function just makes the displayed bars bigger or smaller. Any thoughts? -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu My thoughts are that this goes against everything a histogram is set out to do; attempt to provide a 'discretised' probability distribution function given a set of discrete samples. Lets say a sample lies in the region where two bins overlap. How do you define which bin the sample lies in? Both? If both, how do you define the value of the approximated probability distribution on a bin? You could just take the height of the bin, but some of the bin's mass lies in each of the neighbouring bins. If you don't want to apply mass to the neighbouring bins for a sample that lies in the region where two bins overlap, you could just pick one. You then have the problem of non-uniqueness. If you'd picked the other bin you'd have a different probability distribution function. This a bad property to have. If you don't want to pick a neighbouring bin to apply more mass, and just increase the width of the each bin's matplotlib.patches.Patch object, then that is more sensible. Except now you have the problem of displaying the histogram. Which bin gets displayed over its left neighbour? And its right neighbour? I dread to think what this would imply if you also wanted to stack such histograms. A potential can of worms. The closest I could think of as something reasonable is to apply a convolution of some sort to the discrete pdf to produce an approximation of a continuous PDF. Cheers! Ben Root Yes. That's possible. The issue here, though, is getting the discrete case to start with. There are multiple ways to do it depending on your choice of bin, and the result is not independent of this choice. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] mpl_binutils: Plotting from the command-line with matplotlib
All, Several days ago I tested the waters and asked you guys, the community, how useful you thought a command-line front-end to matplotlib would be. The overwhelmingly positive feedback was enough for me to sit down and figure out how to do this well, and in a way that would mimic existing tools to achieve such tasks. One example being the `graph` utility, which is a part of GNU plotutils. Though there are subtle differences between mpl_binutils and GNU plotutils they, in my opinion, improve the user experience and reduce the ambiguity regarding the parsing of command-line options. I am announcing that mpl_binutils is in a state ready to be tested by you guys. Hopefully you'll find it useful. You can check out the source code here: https://github.com/dmcdougall/mpl_binutils Without getting into details, I ran into some serious limitations with argparse. At the end of the day, nothing is perfect, but some tools are better than others. One such tool, docopt, was shown to me by Mark Lawrence. docopt will change the way I do any python from the command-line in the future. docopt is a light-weight command-line parsing library written in python with no dependencies. mpl_binutils has two dependencies: docopt and matplotlib. Most of you should already have one of these! For the other, a simple `pip install docopt` should work but I had no problems installing it from source (python setup.py install) on OS X. mpl_binutils is currently a single script (a python script), called mpl-graph. There is example usage on the github readme if you'd like to take a look. Currently, mpl-graph doesn't fail gracefully. It should, but I wanted to get something working first. Command-line option validation is next on my todo list and since there are only a handful of command line options implemented (albeit the most useful ones, in my opinion), this shouldn't be too big of a job. Go forth and fork! -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with marker color coded according to z-value
On Fri, Oct 19, 2012 at 10:23 PM, Daπid davidmen...@gmail.com wrote: On Fri, Oct 19, 2012 at 11:08 PM, elmar werling el...@net4werling.de wrote: vmin=min(z), vmax=max(z) A suggestion, when dealing with arrays, it is generally faster to use the numpy function to compute the max and min, either np.max(z) or z.max(), than the standard Python one. Correct me if I'm wrong, but I don't even think you need them. I think the default cmap behaviour is to normalise to the min and max of the data. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mpl command-line utilities
On Thu, Oct 18, 2012 at 10:10 AM, Alexander Eberspaecher alexander.eberspaec...@ovgu.de wrote: Hello, On Wed, 17 Oct 2012 11:38:27 +0100 Damon McDougall damon.mcdoug...@gmail.com wrote: How do people feel about perhaps adding a matplotlib version, mocking the same calling signature as graph? I think the most important question is: would it be useful? Yes, this would certainly be useful! I think there are people unfamiliar with Python, but rather excited about MPL's plotting capabilities. I personally would want it to read data from white-space separated text files (np.loadtxt()), probably CSV files, and HDF5 files (e.g. using h5py, if available). To be useful for different purposes, I'd want the tool to be able to use different backends (producing e.g. PNG output in case you need a figure to send via e-mail or PGF output in case you are preparing a LaTeX document). Matplotlibrc should be hidden from the user. As Gnuplot was specifically mentioned in another e-mail in this thread, let me use that opportunity to mention that MPL falls behind Gnuplot in terms of line styles. Using MPL, I found ls=- and maybe ls=-- to be useful, whereas Gnuplot offers 9 linestyles that are easy to distinguish visually. Compare e.g. the figure linked in http://www.der-schnorz.de/2010/09/gnuplot-colors-presentations-papers-and-contrast/ In case this is of general interest, we might discuss that in a new thread. As a side note, personally, for text file visualisation, I often use this dirty MPL plotting plugin for the text editor of my choice (Geany): https://github.com/aeberspaecher/GeanyPlot A command line tool would of course be preferred. Cheers Alex Ok wow, awesome feedback! I started on this yesterday morning to see how it would go, and I've already got something working that mimics the command-line syntax of GNU's `graph` (except it currently only supports one data file as input). I'm currently just developing on a local feature branch in the matplotlib repository, but I'm happy to pull it out to a different repo and announce it here once I make some more ground on it. I haven't pushed anything yet. If I do I'll make an announcement here. One thing I have noticed is that GNU's `graph` is rather fast. Compared to matplotlib, GNU's `graph` blows matplotlib out of the water when it comes to speed. Though, in my opinion, matplotlib wins when it comes to output quality. As far as I'm concerned, quality wins over speed but I realise that there needs to be some speed improvements in matplotlib's backends. I have noticed that text takes quite a while to process in the backend (currently using Agg for PDF and PNG output). Regarding input data file-type, I agree, supporting those formats would expand our userbase considerably. There are already some helper functions in matplotlib.cbook for reading csv-type files. One downside of supporting lots of different file-types is that there will be more (optional) dependencies. Personally, when I just want to see statistics from a computational run, I think I will find this rather helpful. I think I should be able to make this public fairly soon. Furthermore, it will be trivial to install (copy and paste to the /usr/local/bin directory). The command-line utility is literally just a python script (with executable permissions) that parses command-line arguments and sets up plot and figure parameters. Of course, it may be the case in the future that it gets rather large and needs to be made more modular. Right-o, back to more procrastinating. Thanks for all the encouragement! :) -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] default backend on 1.2.0rc1 and master
On Wed, Oct 17, 2012 at 9:12 AM, Francesco Montesano franz.berges...@gmail.com wrote: 2012/10/17 Eric Firing efir...@hawaii.edu On 2012/10/16 9:22 PM, Francesco Montesano wrote: Dear list, I've see a difference between the default backend between v1.1.1 (shipped with kubuntu 12.10dev) and v1.2.0.rc1, 1.2.0rc2 and master (1.3.x). My set up is to call ipython with pylab and turn on interactive mode. I still haven't copied over my matplotlibrc file from my work computer (there I use qtagg, if I remember well) On v1.1.1 the default is [backend: TkAgg], while in the other two cases it is [backend: agg]. Is there some reason for this difference? The default should be based on what is found when mpl is built, so it sounds like when you are building v1.2.x, none of the supported gui toolkits is being found. I don't know why that is. Are you installing on a system that has gui toolkits already installed? I think so, as the v1.1.1 shipped with my OS is using TkAgg as backend and I can plot interactively. When I build from source I get OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) Tkinter: no * Using default library and include directories for * Tcl and Tk because a Tk window failed to open. * You may need to define DISPLAY for Tk to work so * that setup can determine where your libraries are * located. Tkinter present, but header files are not * found. You may need to install development * packages. * You may need to install 'dev' package(s) to * provide header files. Gtk+: no * Could not find Gtk+ headers in any of * '/usr/local/include', '/usr/include', * '/usr/local/include', '/usr/include', '.' Mac OS X native: no Qt: no Qt4: Qt: 4.8.2, PyQt4: 4.9.3 PySide: no Cairo: 1.8.8 Could be a problem with Tkinter and dev packages. One useful technique with ubuntu derivatives is to do sudo apt-get build-dep python-matplotlib probably it's easier if I just switch to qtagg, as I already have it It might pull in more than you really want, but it will certainly include gui toolkits. Eric Thanks, Francesco cheers, Francesco Packages have whatever default backend the maintainer decided to build them with. For example, the macports packaged version of matplotlib is maintained by someone who specifies the macosx backend to be the default. When building from source, I think the TkAgg backend is the default, because most platforms have tkinter installed out of the box. Since it appears you don't have Tkinter installed, Agg is the default. Agg is a non-gui backend (but it produces awesome output). -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] mpl command-line utilities
All, I was brain-storming yesterday and I wanted to test the waters to see if people would find it useful. Currently, GNU plotutils comes with command-line utilities such as `graph` to create quick and dirty line plots like this: http://www.gnu.org/software/gsl/manual/html_node/DWT-Examples.html. I think even gnuplot might be similar. How do people feel about perhaps adding a matplotlib version, mocking the same calling signature as graph? I think the most important question is: would it be useful? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem saving open symbols in PDF
On Wed, Oct 17, 2012 at 5:56 PM, Gökhan Sever gokhanse...@gmail.com wrote: On Wed, Oct 17, 2012 at 10:21 AM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 17, 2012 at 12:17 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks Mike, Another point I noticed is setting linewidth to 0 (in fill_between function) isn't working as expected when figure is saved as a PDF file. I noticed this while posting a sample script on scipy-users: http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.py Compare the outputs of pdf and png to see the difference that I am mentioning: http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.pdf http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.png Actually, this is not a bug in mpl. It is a bug in various viewers. Some viewers have a minimum linewidth and will use that for any requested linewidths smaller than that. Are you using Apple's Preview? Cheers! Ben Root Hi Ben, I was guessing the same way, but trying different viewers doesn't make any difference: Evince v3.2.1 Xpdf v3.03 Okular v0.14.3 Could anyone confirm this on a window machine? -- Gökhan Confirmed with Preview.app on OS X 10.7.4. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem saving open symbols in PDF
On Wed, Oct 17, 2012 at 6:13 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 17, 2012 at 1:08 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Wed, Oct 17, 2012 at 5:56 PM, Gökhan Sever gokhanse...@gmail.com wrote: On Wed, Oct 17, 2012 at 10:21 AM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 17, 2012 at 12:17 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks Mike, Another point I noticed is setting linewidth to 0 (in fill_between function) isn't working as expected when figure is saved as a PDF file. I noticed this while posting a sample script on scipy-users: http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.py Compare the outputs of pdf and png to see the difference that I am mentioning: http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.pdf http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.png Actually, this is not a bug in mpl. It is a bug in various viewers. Some viewers have a minimum linewidth and will use that for any requested linewidths smaller than that. Are you using Apple's Preview? Cheers! Ben Root Hi Ben, I was guessing the same way, but trying different viewers doesn't make any difference: Evince v3.2.1 Xpdf v3.03 Okular v0.14.3 Could anyone confirm this on a window machine? -- Gökhan Confirmed with Preview.app on OS X 10.7.4. I think it looks ok with the old Adobe viewer on linux (I never bothered updating it since I use Evince). Kinda hard to tell the difference between grey and greyer... Could somebody include a screenshot of what they are seeing? Sir, the internet has completed your request: http://i.imgur.com/UdRB9.png Ben Root -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem saving open symbols in PDF
On Wed, Oct 17, 2012 at 6:58 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 17, 2012 at 1:21 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Wed, Oct 17, 2012 at 6:13 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 17, 2012 at 1:08 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Wed, Oct 17, 2012 at 5:56 PM, Gökhan Sever gokhanse...@gmail.com wrote: On Wed, Oct 17, 2012 at 10:21 AM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 17, 2012 at 12:17 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks Mike, Another point I noticed is setting linewidth to 0 (in fill_between function) isn't working as expected when figure is saved as a PDF file. I noticed this while posting a sample script on scipy-users: http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.py Compare the outputs of pdf and png to see the difference that I am mentioning: http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.pdf http://atmos.uwyo.edu/~gsever/data/test/curvefit_test.png Actually, this is not a bug in mpl. It is a bug in various viewers. Some viewers have a minimum linewidth and will use that for any requested linewidths smaller than that. Are you using Apple's Preview? Cheers! Ben Root Hi Ben, I was guessing the same way, but trying different viewers doesn't make any difference: Evince v3.2.1 Xpdf v3.03 Okular v0.14.3 Could anyone confirm this on a window machine? -- Gökhan Confirmed with Preview.app on OS X 10.7.4. I think it looks ok with the old Adobe viewer on linux (I never bothered updating it since I use Evince). Kinda hard to tell the difference between grey and greyer... Could somebody include a screenshot of what they are seeing? Sir, the internet has completed your request: http://i.imgur.com/UdRB9.png Ben Root Thanks! That helps. With the older Adobe viewer for linux, there is a very slight line, but not nearly as pronounced as Apple's Preview (which is where I originally encountered this issue about a year ago). Attaching a screen capture for reference. Cheers! Ben Root Also notice the triangle transparency... -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Clipping Contours
On Tue, Oct 16, 2012 at 8:04 AM, T J tjhn...@gmail.com wrote: I'm interested in clipping the result of plt.contour (and plt.contourf) to a patch. However, QuadContourSet does not have a set_clip_path() method. Is there a way to do this? Here is an example plot that I have generated. http://imgur.com/pybIf For the curious, it plots contours of a function on the 2-simplex. The way I've gone about computing this is, unfortunately, convoluted. I generate a regular grid in 2D and treat each point as a projection of a 3D probability vector into 2D. Then, I invert the projection so that I have distributions and then compute the Z value for each point. The contours are then calculated, but now, I need to clip everything outside the triangle, as only points within the triangle correspond to actual distributions. Is there a more direct way to calculate contours on a restricted set? Thanks. The contour functions support masked regions. I think that might be what you're looking for. Since the region you want to mask is a triangle, maybe even use a masked triangulated contour plot? Here's the call signature: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.tricontour Does that help? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] close a figure after show , when plotting many figures from script- using matplotlib.pyplot.figure
On Tue, Oct 16, 2012 at 5:09 PM, Sterling Smith smit...@fusion.gat.com wrote: Hari, You can give a number to figure(), as in figure(1), and it will reuse figure 1. Also, you can close figure 1 with pyplot.close(1). -Sterling On Oct 16, 2012, at 8:25AM, hari jayaram wrote: Hi I am a relative newbie to matplotlib. I have a python script that handles a dataset that comprises 384 sets of data. At the present moment , I read in a set of data - process it - and the create a figure using code shown below. I am using windows with the default backend ( I think I set it to wx). When I run the program, figure after figure shows up..the program continues from well to well plotting the figure. I can close the figure window using the X on the right -hand side..while the program chugs along. Is there a way to just recycle the figure object , so that the plot shows up for a brief second and refreshes when the next calculation is complete. Each process_data function , takes a few minutes. Alternatively I just want to close the figure object I show after a brief lag. I am OK if that happens instantaneously..but I dont know how to achieve this. Do I have to use the matplotlib.Figure object to achieve this functionality Thanks Hari from matplotlib.pyplot import figure def do_my_plot(well_id): processed_data_object = processed_dict[well_id] fig = figure(figsize=(7,7) ax = fig.add_subplot(1,1,1) par1 =ax.twinx() par2 = ax.twinx() # Plot all the data par1.plot(processed_data_object.raw_x,processed_data_object.raw_y). par2.plot( # finally fig.show() # I tried fig.clf() def plot_and_process_data(): for well_id in list_of_384_well_ids: process_data(well_id) do_my_plot(well_id) Or you can call ax.cla() to clear the axes before plotting the next data set. Then subsequent calls to plot don't need 300+ figure objects. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setupegg.py modifies sys.path?
On Mon, Oct 15, 2012 at 7:22 PM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Oct 15, 2012 at 2:11 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: I tried a `python setupegg.py develop` to diagnose a bug for someone. Now my mpl git repo has magically appeared at the front of my sys.path. Since I cleaned out the lib/matplotlib directory, I now get import errors like No module named matplotlib._path because it's looking in my git repo for all the modules. I've spent about an hour trying to figure out what else might modified my sys.path and this is the conclusion I've come to. I've nuked ~/.pip and ~/.ipython to no avail. Did setupegg modify my sys.path? If so, how do I change it back? setupegg develop does not modify the sys.path (at least, not permanently -- not sure exactly what it does deep under the hood). What it does is adds a .egg-lnk file in your site-packages directory to point to your source code tree. Get rid of that .egg-lnk file, and you should be good to go. Ben Root That had no affect. I figured it out. easy_install edited a file called easy_install.pth and added a bunch of directories. Cheers for the help. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Format date tick labels
On Thursday, October 11, 2012, Benjamin Root wrote: On Thu, Oct 11, 2012 at 4:53 PM, Mark Lawrence breamore...@yahoo.co.ukjavascript:_e({}, 'cvml', 'breamore...@yahoo.co.uk'); wrote: On 11/10/2012 10:55, Damon McDougall wrote: On Wed, Oct 10, 2012 at 5:00 PM, Benjamin Root ben.r...@ou.edujavascript:_e({}, 'cvml', 'ben.r...@ou.edu'); wrote: On Wed, Oct 10, 2012 at 10:55 AM, Mark Lawrence breamore...@yahoo.co.uk javascript:_e({}, 'cvml', 'breamore...@yahoo.co.uk'); wrote: On 10/10/2012 15:41, Mark Lawrence wrote: On 10/10/2012 14:29, Benjamin Root wrote: I know of a few people who have difficulties with matplotlib's datetime handling, but they are usually operating on the scale of milliseconds or less (lightning data), in which case, one is already at the edge of the resolution handled by python's datetime objects. However, we would certainly welcome any sort of examples of how matplotlib fails in handling seconds scale and lower plots. Cheers! Ben Root I'll assume that the milliseconds above is a typo. From http://docs.python.org/library/datetime.html class datetime.timedelta A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. Still, what's a factor of 1000 amongst friends? :) http://www.python.org/dev/peps/pep-0418/ has been implemented in Python 3.3 and talks about clocks with nanosecond resolutions. I've flagged it up here just in case people weren't aware. Ah, you are right, I meant microseconds. With apologies to Spaceballs: Prepare to go to microsecond resolution! No, no, microsecond resolution is too slow Microsecond resolution is too slow? Yes, too slow. We must use nanosecond resolution! Prep-- Prepare Python, for nanosecond resolution! Cheers! Ben Root Am I missing something here? Are seconds just floats internally? A delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter doesn't do any denormalising http://stackoverflow.com/questions/9314534/why-does-changing-0-1f-to-0-slow-down-performance-by-10x when encountered with deltas very close to zero... What percentage of computer users wants a delta of 1e-12? I suspect that the vast majority of users couldn't care two hoots about miniscule time deltas in a world where changing time zones can cause chaos. Where some applications cannot handle years before 1970, or 1904, or 1900 or whatever. Or they can't go too far forward, 2036 I think but don't quote me. Where people like myself had to put a huge amount of effort into changing code so that applications would carry on working when the date flipped over from 31st December 1999 to 1st January 2000. If things were that simple why is matplotlib using third party modules like dateutil and pytz? Why doesn't the batteries included Python already provide this functionality? Preach on, my brother! Preach on! [psst -- you are facing the choir...] Cheers! Ben Root Clearly I have misunderstood something and hit a nerve. Apologies. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: color pallette suggestions wanted
Forgot to reply all. -- Forwarded message -- From: *Damon McDougall* Date: Friday, October 12, 2012 Subject: [Matplotlib-users] color pallette suggestions wanted To: Andreas Hilboll li...@hilboll.de On Fri, Oct 12, 2012 at 10:17 AM, Andreas Hilboll li...@hilboll.dejavascript:; wrote: Hi, I have some data I want to plot using pcolormesh. It's 2d climatological data, see the attached plot. My data is in a range from -7 to +0.6. I want to be 0.0 to be clearly visible, while at the same time, the color range should show the full dynamic of the values. I played with the bwr and seismic color maps, centering on zero, so that white is 0.0. However, I'm not too happy with the dynamic range I get in the negative. Your data is not symmetric about zero, so you will always get a result the looks 'too dynamic' in the negative values (that is, if you want to use the whole colour map range). You need to make a sacrifice somewhere to get the effect you want. 1) Move your data so it's symmetric around zero, that way you'll get a nice dynamic change, but the position of 'zero' will be less clear. 2) Don't move your data and use a truncated colour map. That way the position of 'zero' will be clear but you'll get less dynamic change in the negative values. Hope this helps. Best, Damon -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] data grid problem
On Wed, Oct 10, 2012 at 3:55 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 10, 2012 at 9:40 AM, rand0m ran...@0x06.net wrote: Hello, I'm new to matplotlib and I hope you can help me out with my question. When drawing for example a Rectangle() I have to specify it like the following: rect = Rectangle((1, 3), 2, 20, facecolor=#aa) Where 2 is the length and 20 is the height. (1,3) is for xy. Imagine a coordination system where x-axis should represent the value 0 to 100. I would like to draw the rectangle from 50 to 60 on x-axis. So I would specify: rect = Rectangle((50, 3), 10, 20, facecolor=#aa) But this does not work as desired because at the xtick 50 the x-axis does not hold the value 50 but 5 because I made xticks 1-100 with step 10. So my x-axis holds the values 1-10. But I need 1-100. If anyone knows what Im missing I d be glad to hear about it :-). thank you I am not quite sure I understand what you mean. Can you attach an image of the plot you made so far? Ben Root I'm not sure if adding a patch autoscales the view, try rect = Rectangle((50, 3), 10, 20, facecolor=#aa) ax.add_patch(rect) ax.set_xlim(0, 100) ax.set_ylim(0, 25) -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pylab import error due to dateutil
On Wed, Oct 10, 2012 at 3:09 PM, Michael Droettboom md...@stsci.edu wrote: I filed an issue for this. We should try to get the fix into 1.2.x https://github.com/matplotlib/matplotlib/issues/1354 Mike On 10/10/2012 09:00 AM, Michael Droettboom wrote: I think this stack overflow question [1] sort of sums up the problem -- setuptools develop is kind of a hack and only really works if the source structure matches the installed structure. That used to be true of matplotlib, but installing different packages based on the Python version breaks that assumption. A suggestion in the Stack Overflow entry is to install symlinks to fix this, and indeed doing this works: cd lib ln -s dateutil_py2 dateutil We can probably automate this in the setupegg.py script, but I don't think I'll have a chance to get to this today. We can't just include the symlink in git, since it should point to the version that corresponds to the user's Python. [1] http://stackoverflow.com/questions/6019042/is-there-a-way-to-add-a-namespace-prefix-setuptools-package-distributions Mike On 10/10/2012 08:50 AM, Michael Droettboom wrote: This is related to using develop mode. I never use that (I use virtualenvs instead), so this doesn't get much testing. This seems to have broken when we started to ship separate versions of dateutil for python2 and python3. setuptools doesn't seem to like the fact that we rename dateutil_py2 to dateutil when installing (since in develop mode it doesn't really install or move anything). That's problematic, of course. I'll have to see if there's another way to handle this. Mike On 10/09/2012 09:36 PM, Gökhan Sever wrote: Hello, With a fresh git clone git://github.com/matplotlib/matplotlib.git sudo python setupegg.py develop Starting ipython --pylab I get this error: .../matplotlib/lib/matplotlib/dates.py in module() 120 import matplotlib.ticker as ticker 121 -- 122 from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \ 123 MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY 124 from dateutil.relativedelta import relativedelta ImportError: No module named dateutil.rrule Installing dateutil 1.5 fixes this. mpl install log shows the following: OPTIONAL DATE/TIMEZONE DEPENDENCIES dateutil: matplotlib will provide pytz: matplotlib will provide Will dateutil be shipped with mpl or this line needs to be updated? Thanks. -- Gökhan Gökhan, did you implement the symlink fix? If so, would you mind making a pull request out of it? I was just about to look into doing this, but if you've done it already that'd save us some effort rolling out fixes for 1.2. Cheers. Damon -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Format date tick labels
On Wed, Oct 10, 2012 at 5:00 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 10, 2012 at 10:55 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 10/10/2012 15:41, Mark Lawrence wrote: On 10/10/2012 14:29, Benjamin Root wrote: I know of a few people who have difficulties with matplotlib's datetime handling, but they are usually operating on the scale of milliseconds or less (lightning data), in which case, one is already at the edge of the resolution handled by python's datetime objects. However, we would certainly welcome any sort of examples of how matplotlib fails in handling seconds scale and lower plots. Cheers! Ben Root I'll assume that the milliseconds above is a typo. From http://docs.python.org/library/datetime.html class datetime.timedelta A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. Still, what's a factor of 1000 amongst friends? :) http://www.python.org/dev/peps/pep-0418/ has been implemented in Python 3.3 and talks about clocks with nanosecond resolutions. I've flagged it up here just in case people weren't aware. Ah, you are right, I meant microseconds. With apologies to Spaceballs: Prepare to go to microsecond resolution! No, no, microsecond resolution is too slow Microsecond resolution is too slow? Yes, too slow. We must use nanosecond resolution! Prep-- Prepare Python, for nanosecond resolution! Cheers! Ben Root Am I missing something here? Are seconds just floats internally? A delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter doesn't do any denormalisinghttp://stackoverflow.com/questions/9314534/why-does-changing-0-1f-to-0-slow-down-performance-by-10x when encountered with deltas very close to zero... -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] data grid problem
On Thu, Oct 11, 2012 at 1:52 PM, Benjamin Root ben.r...@ou.edu wrote: On Thursday, October 11, 2012, Damon McDougall wrote: On Wed, Oct 10, 2012 at 3:55 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 10, 2012 at 9:40 AM, rand0m ran...@0x06.net wrote: Hello, I'm new to matplotlib and I hope you can help me out with my question. When drawing for example a Rectangle() I have to specify it like the following: rect = Rectangle((1, 3), 2, 20, facecolor=#aa) Where 2 is the length and 20 is the height. (1,3) is for xy. Imagine a coordination system where x-axis should represent the value 0 to 100. I would like to draw the rectangle from 50 to 60 on x-axis. So I would specify: rect = Rectangle((50, 3), 10, 20, facecolor=#aa) But this does not work as desired because at the xtick 50 the x-axis does not hold the value 50 but 5 because I made xticks 1-100 with step 10. So my x-axis holds the values 1-10. But I need 1-100. If anyone knows what Im missing I d be glad to hear about it :-). thank you I am not quite sure I understand what you mean. Can you attach an image of the plot you made so far? Ben Root I'm not sure if adding a patch autoscales the view, try rect = Rectangle((50, 3), 10, 20, facecolor=#aa) ax.add_patch(rect) ax.set_xlim(0, 100) ax.set_ylim(0, 25) We managed to solve it, but apparently it was off-list. Essentially, I showed him how to use a MultipleLocator to control the axis ticks, rather than labeling them manually at a different scale. Ben Root I thought that might have been the problem. Cheers for the follow-up Ben. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
On Thu, Oct 11, 2012 at 4:00 PM, Nikolaus Rath nikol...@rath.org wrote: When saving the figure in some vector graphics format, I don't see what the meaning of the dpi is at all. Sure, I use `dpi=` all the time for vector formats. Purely because when you make calls to `imshow`, you get a rasterised image embedded in a figure with vector text and tickmarks and labels, for example. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pylab import error due to dateutil
On Thursday, October 11, 2012, Gökhan Sever wrote: On Thu, Oct 11, 2012 at 3:49 AM, Damon McDougall damon.mcdoug...@gmail.com javascript:_e({}, 'cvml', 'damon.mcdoug...@gmail.com'); wrote: Gökhan, did you implement the symlink fix? If so, would you mind making a pull request out of it? I was just about to look into doing this, but if you've done it already that'd save us some effort rolling out fixes for 1.2. Cheers. Damon Hi Damon, I think adding these lines before execfile line in setupegg.py should fix it: import os os.chdir('lib') if not os.path.isdir('dateutil'): os.symlink('dateutil_py2', 'dateutil') os.chdir('..') Could you give it a test? Do we require a similar symlink for py3? Thanks. -- Gökhan Awesome. I'll give it a go later on. I'm a little concerned using os.chdir. I think Peter Wuertz/Chris Gohlke had problems with it not being threadsafe on windows. Does the same apply here? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Pylab import error due to dateutil
On Thu, Oct 11, 2012 at 9:25 PM, Gökhan Sever gokhanse...@gmail.com wrote: I am not sure about that technical detail, but it works fine here on my Fedora 16 (x86_64) system. On Thu, Oct 11, 2012 at 11:04 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Thursday, October 11, 2012, Gökhan Sever wrote: On Thu, Oct 11, 2012 at 3:49 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Gökhan, did you implement the symlink fix? If so, would you mind making a pull request out of it? I was just about to look into doing this, but if you've done it already that'd save us some effort rolling out fixes for 1.2. Cheers. Damon Hi Damon, I think adding these lines before execfile line in setupegg.py should fix it: import os os.chdir('lib') if not os.path.isdir('dateutil'): os.symlink('dateutil_py2', 'dateutil') os.chdir('..') Could you give it a test? Do we require a similar symlink for py3? Thanks. -- Gökhan Awesome. I'll give it a go later on. I'm a little concerned using os.chdir. I think Peter Wuertz/Chris Gohlke had problems with it not being threadsafe on windows. Does the same apply here? I'm not sure how to test this. I'm running `setupegg.py develop` from within a python virtual env, but somehow it's picking up dateutil version 1.5. I don't get the `matplotlib will provide` message... Hmm. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Corrupted percent signs in labels
On Tue, Oct 9, 2012 at 10:32 PM, Nikolaus Rath nikol...@rath.org wrote: Hello, For some reason, my matplotlib isn't able to print percent signs ('%') properly: [1] inspiron:~/tmp# cat mplbug.py import matplotlib import matplotlib.pyplot as plt import numpy as np print matplotlib.__version__ plt.plot(np.arange(10), np.arange(10)**2) plt.xlabel('Percent [%]') plt.savefig('mplbug.pdf') [0] inspiron:~/tmp# python mplbug.py 1.1.1rc2 I have attached the resulting PDF. For some reason, the slash in the percent sign becomes a triangle that partially covers the upper left circle. Known bug? Any workarounds that don't require upgrading (I'd like to stick with the Debian package)? Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C I'm using the AGG backend and saving to a png file without any problems, but I'm using the current git master branch. I'll try to see if I can recreate on 1.1.1rc2. Watch this space. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Corrupted percent signs in labels
On Tue, Oct 9, 2012 at 10:56 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 9, 2012 at 10:32 PM, Nikolaus Rath nikol...@rath.org wrote: Hello, For some reason, my matplotlib isn't able to print percent signs ('%') properly: [1] inspiron:~/tmp# cat mplbug.py import matplotlib import matplotlib.pyplot as plt import numpy as np print matplotlib.__version__ plt.plot(np.arange(10), np.arange(10)**2) plt.xlabel('Percent [%]') plt.savefig('mplbug.pdf') [0] inspiron:~/tmp# python mplbug.py 1.1.1rc2 I have attached the resulting PDF. For some reason, the slash in the percent sign becomes a triangle that partially covers the upper left circle. Known bug? Any workarounds that don't require upgrading (I'd like to stick with the Debian package)? Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C I'm using the AGG backend and saving to a png file without any problems, but I'm using the current git master branch. I'll try to see if I can recreate on 1.1.1rc2. Watch this space. No dice. I still can't recreate your problem on OS X 10.7.4 with matplotlib version 1.1.1-rc2. What are your font/tex specifications in the matplotlib.rcParams dictionary? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] But report: Date axis formatter problem
On Mon, Oct 8, 2012 at 4:37 PM, Jianbao Tao jianbao@gmail.com wrote: Problem: The autodatelocator and autodateformatter don't seem to work properly. One, the formatter doesn't seem to work immediately after being applied to an axis. A manual call to the locator seems necessary. Two, the autodatelocator doesn't seem to be able to handle view intervals less than 1 second, i.e., the tick labels don't show digits beyond second. You can see this by zooming the example figure from the code below to a level shorter than one second. 1. Operating system: OS X 10.8.2 2. matplotlib version: 1.2.0rc2 3. I installed matplotlib via: pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev 4. Backend: TkAgg, but I don't think the problem depends on the backend. 5. Code: #- code - # Running in ipython --pylab mode. fig = figure() tsta = num2epoch(date2num(datetime.datetime.now())) tarr = tsta + arange(0, 60*30., 0.01) # half hour, dt = 0.01 sec x = np.array(num2date(epoch2num(tarr))) nt = len(tarr) y = randn(nt) ax = fig.add_subplot(111) ax.plot(x, y) fig.canvas.draw() # Show an overall view of the data locator = mpl.dates.AutoDateLocator() formatter = mpl.dates.AutoDateFormatter(locator) formatter.scaled = { 365.0 : '%Y', 30. : '%b %Y', 1.0 : '%b %d', 1./24. : '%H:%M', 1./24./60. : '%M:%S', 1./24./60./60. : '%S', } ax.get_xaxis().set_major_formatter(formatter) # Won't work immediately. locator.set_axis(ax.xaxis) # Have to manually make this call and the one below. locator.refresh() # Another manual call. fig.canvas.draw() # end of code I put it on github: https://github.com/matplotlib/matplotlib/issues/1343 -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] XKCD style graphs?
On Fri, Oct 5, 2012 at 10:13 AM, Matthias BUSSONNIER bussonniermatth...@gmail.com wrote: Le 4 oct. 2012 à 23:09, Juergen Hasch a écrit : Here is my take on it as an IPython notebook, based on Damon's code: http://nbviewer.ipython.org/3835181/ I took the engineering approach and filtered the random function instead of doing some fft/ifft magic. Also, X and Y of the functions are affected now, giving them a more natural look in the slopes. Juergen If anyone have time to make some examples and a right side thumbnail I can make it as featured notebook in the front page of nbviewer. You can even make a direct PR agains nbviewer and I would then just have to merge and deploy. To be fair, notebook should also give some explanation of the code, link to this discussion, maybe show one original xkcd graph. Please take your time, and if there is several submission, we'll sort out how to choose the best(s). -- Matthias Am 04.10.2012 18:09, schrieb Pierre Haessig: Le 04/10/2012 16:35, Pierre Haessig a écrit : So I think this code indeed resamples the rastered plot image on a shaken coordinate grid. I kind of understand that the noise on coordinates is spatially smoothed by a 10px Gaussian Point Spread Function (if I understand correctly...) I've implemented this processing in a tiny image_shake script. https://gist.github.com/3834536 A nice occasion to learn how to use some scipy image processing functions... I've attached the before/after images because I didn't manage to put them in the Gist (it's not a plot image but gives the idea of line shaking). Now, I think it's unfortunately outside the frame of Fernando's challenge, because this script uses zero matplotlib methods!! Best, Pierre This thread has made my week. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with shared axis
On Fri, Oct 5, 2012 at 5:44 PM, Jianbao Tao jianbao@gmail.com wrote: Hi, I am working on a time-series data browser based on matplotlib. In general, it shows a N_row x 1_col stack of axes, which share the x axis, the time axis. It is nice that matplotlib offers the sharex option so that the data can be zoomed simultaneously in time. However, one problem with the sharex option is that it not only shares the axis range (or limits, if you will), but also the axis appearance, which is not always desirable. In my case, I want the tick labels to be shown only on the bottom subplot. However, that doesn't seem to be achievable with sharex. The follow snippet demonstrates my example: #- code import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(211) ax2 = fig.add_subplot(212, sharex=ax1) ax1.get_xaxis().set_ticklabels([]) # This also suppresses x tick labels of ax2. fig.canvas.draw() #-- end of code Is there a workaround, hopefully simple and straightforward, to share range (or limits) only among axes? Better yet, can this feature be added, like a keyword sharexrange, in the future, if it is not already there? Of course, the situation should be similar for y axis, too. Thank you very much. Jianbao This was the first hit in a google search: http://stackoverflow.com/questions/4209467/matplotlib-share-x-axis-but-dont-show-x-axis-tick-labels-for-both-just-one -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib produced plots in academic journal articles
On Fri, Oct 5, 2012 at 7:42 PM, Fernando Perez fperez@gmail.com wrote: On Fri, Oct 5, 2012 at 10:45 AM, Nelle Varoquaux nelle.varoqu...@gmail.com wrote: Here is an example on circos' website of how they advertise the use of their plotting library in research: http://circos.ca/intro/published_images/ Wow, that is one hell of a visually spiffy site. Can't find any links to development repositories, but in terms of targeting end users, the author (because it looks like a single-person job, given the many I references) has done a solid job. Sites like this remind me that we really should put a bit more effort into the 'marketing' aspect of our sites. From what I can tell, circos is very nice but has nowhere the technical depth, complexity and flexibility of matplotlib. It's a fairly narrowly targeted tool. But a site like that makes it really appealing to people. Thanks for that link, Nelle! Yes, that site was *full* of eye-candy. It's maybe a bit over the top, but it's certainly a good reference. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib produced plots in academic journal articles
On Fri, Oct 5, 2012 at 8:11 PM, Gökhan Sever gokhanse...@gmail.com wrote: Seeing mpl produced plots would be only 1 or 2 clicks away, plus this would This is not true. A lot of articles are unavailable to certain institutions due to a lack of subscription. A major sticking point. Am I wrong in thinking that journals copyright the final product? Thus, it would be up to the author(s) to decide whether or not to 'donate' a figure for a gallery. provide context to the use of plots rather that extracting figures and putting them separately (dealing with copyright issues and such) on an alternative gallery page. The figures you linked look shinny but not much practical use in my field. Point taken on the context argument. I'll take that. To resolve it, make the figure/html image link to the underlying publication? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib produced plots in academic journal articles
On Fri, Oct 5, 2012 at 8:58 PM, Gökhan Sever gokhanse...@gmail.com wrote: On Fri, Oct 5, 2012 at 1:23 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Fri, Oct 5, 2012 at 8:11 PM, Gökhan Sever gokhanse...@gmail.com wrote: Seeing mpl produced plots would be only 1 or 2 clicks away, plus this would This is not true. A lot of articles are unavailable to certain institutions due to a lack of subscription. A major sticking point. I was only thinking open-access journals, which open-source users (i.e. users of python tools) tend to publish their articles in open-journals. Of course, there are subscription required articles but those are secondary concerns. Sometimes authors make their articles publicly available even the article is on a paid journal. That's a good idea. Steven Boada's comment re: the arxiv is also a good one. This looks workable :) provide context to the use of plots rather that extracting figures and putting them separately (dealing with copyright issues and such) on an alternative gallery page. The figures you linked look shinny but not much practical use in my field. Point taken on the context argument. I'll take that. To resolve it, make the figure/html image link to the underlying publication? Citation listing is easier for me, we can go both ways, a page listing only citations, another one a more experimental figure/citation if copyright issues can be resolved easily. In anyways, we will have to gather citations. Let's start doing that? Sounds good to me. Thanks for all the input. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] automating-xkcd-diagrams-transforming-serious-to-funny
On Fri, Oct 5, 2012 at 11:18 PM, Neal Becker ndbeck...@gmail.com wrote: http://blog.wolfram.com/2012/10/05/automating-xkcd-diagrams-transforming- serious-to-funny/ I wonder if mpl has anything along these lines? https://github.com/matplotlib/matplotlib/pull/1329 -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] XKCD style graphs?
On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig pierre.haes...@crans.org wrote: Hi Fernando, Le 04/10/2012 09:16, Fernando Perez a écrit : This would make for an awesome couple of examples for the gallery, the mathematica solutions look really pretty cool: http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs I've never used Mathematica so that it's pretty difficult for me to understand the following lines of code which I guess do the main job of distorting the image xkcdDistort[p_] := Module[{r, ix, iy}, r = ImagePad[Rasterize@p, 10, Padding - White]; {ix, iy} = Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ GaussianMatrix[10], {2}]; ImagePad[ImageTransformation[r, # + 15 {ImageValue[ix, #], ImageValue[iy, #]} , DataRange - Full], -5]]; Is there somebody there that can describe this algorithm with words (English or Python ;-)) ? I feel like the key point is about adressing the rasterized plot image r with some slightly randomized indices ix and iy. However, I really don't get the step that generates these indices. Best, Pierre I believe this is in your interests: http://i.imgur.com/5XwRO.png Here's the code: https://gist.github.com/3832579 Disclaimer: The code is ugly; don't judge me. Also, I installed the Humor Sans font but I couldn't get mpl to find it. Oh well :) I got the font working :) http://i.imgur.com/Dxemm.png -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] XKCD style graphs?
On Thu, Oct 4, 2012 at 3:35 PM, Pierre Haessig pierre.haes...@crans.org wrote: Le 04/10/2012 16:03, Jason Grout a écrit : f@r means f(r) a~ImageConvolve~b means ImageConvolve(a,b) (~ treats an operator as infix) Table[..., {2}] means [... for i in range(2)] #+1 is a lambda function lambda x: x+1 So I think it goes something like: def xkcdDistort(p): r = ImagePad(Rasterize(p), 10, Padding='White') (ix, iy) = [ImageConvolve(RandomImage([-1,1], ImageDimensions(r)), GaussianMatrix(10)) for i in range(2)] return ImagePad(ImageTransformation(r, lambda coord: (coord[0]+15*ImageValue(ix, coord), coord[1]+15*ImageValue(iy, coord)), DataRange='Full'), -5) Thanks a lot! It's the first time I encounter Mathematica syntax. Some of these functional notations are not so easy to follow for my unexperienced eyes but it makes this Mathematica code nicely compact. So I think this code indeed resamples the rastered plot image on a shaken coordinate grid. I kind of understand that the noise on coordinates is spatially smoothed by a 10px Gaussian Point Spread Function (if I understand correctly...) Best, Pierre Adding Gaussian noise to each point on a function doesn't look nice. That's why I produced a random function in Fourier space first. That way, random functions still have some sense of smoothness. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] XKCD style graphs?
On Thu, Oct 4, 2012 at 10:09 PM, Juergen Hasch pyt...@elbonia.de wrote: Here is my take on it as an IPython notebook, based on Damon's code: http://nbviewer.ipython.org/3835181/ I took the engineering approach and filtered the random function instead of doing some fft/ifft magic. Also, X and Y of the functions are affected now, giving them a more natural look in the slopes. Juergen I think I actually prefer your output over mine :) Nice job. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imlim in ax.imshow
On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye kmichael@gmail.com wrote: Hi! I see that the function ax.imshow takes the parameter 'imlim' but in the source (status: EPD 7.3-2) it is not being used? So what is it for? Best regards, Michael Confirmed. I don't see imlim anywhere except in the imshow() signature. I have no recollection of this parameter, so it might be from before my time. Ben Root Is there some functionality you were looking for or were you just exploring the codebase? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: imlim in ax.imshow
Forgot to reply all. Sorry. -- Forwarded message -- From: Damon McDougall damon.mcdoug...@gmail.com Date: Tue, Oct 2, 2012 at 7:09 PM Subject: Re: [Matplotlib-users] imlim in ax.imshow To: K.-Michael Aye kmichael@gmail.com On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye kmichael@gmail.com wrote: On Oct 2, 2012, at 6:33 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye kmichael@gmail.com wrote: Hi! I see that the function ax.imshow takes the parameter 'imlim' but in the source (status: EPD 7.3-2) it is not being used? So what is it for? Best regards, Michael Confirmed. I don't see imlim anywhere except in the imshow() signature. I have no recollection of this parameter, so it might be from before my time. Ben Root Is there some functionality you were looking for or were you just exploring the codebase? How nice of you to ask! ;) Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot? Michael -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom Is the 'extent' keyword what you're looking for? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] X Window System error
On Tue, Oct 2, 2012 at 6:07 PM, Eric Firing efir...@hawaii.edu wrote: On 2012/10/02 4:12 AM, Mic wrote: Hi Eric, I have a dataset which contains about 4600 values. Is it possible to display 4600 values with a bar char and labels? Thank you in advance. Mic, I don't think so, as a practical matter. A screen doesn't even have that many pixels of width. Eric On Tue, Oct 2, 2012 at 4:04 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: On 2012/10/01 7:28 PM, Mic wrote: Hi, I have got the following error with the following code: /$ python mpl.py/ http://mpl.py/ /Traceback (most recent call last):/ / File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py, line 398, in expose_event/ /self._render_figure(self._pixmap, w, h)/ / File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py, line 75, in _render_figure/ /FigureCanvasAgg.draw(self)/ / File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py, line 416, in draw/ /self.renderer = self.get_renderer()/ / File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py, line 435, in get_renderer/ /self.renderer = RendererAgg(w, h, self.figure.dpi)/ / File /usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py, line 72, in __init__/ /self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)/ /ValueError: width and height must each be below 32768/ /The program 'mpl.py' received an X Window System error./ /This probably reflects a bug in the program./ /The error was 'BadAlloc (insufficient resources for operation)'./ / (Details: serial 486 error_code 11 request_code 53 minor_code 0)/ / (Note to programmers: normally, X errors are reported asynchronously;/ / that is, you will receive the error a while after causing it./ / To debug your program, run it with the --sync command line/ / option to change this behavior. You can then get a meaningful/ / backtrace from your debugger if you break on the gdk_x_error() function.)/ With the following code: /import random / /import matplotlib.pyplot as plt / // /coverages = [random.randint(1,10)*2] * 4605 / /contig_names = ['AAB0008r'] * len(coverages) / /# Set the figure size / /#fig = plt.figure(1, [20, 2]) / /fig = plt.figure(figsize=(int(len(coverages)*0.1), 4)) / // /ax = fig.add_subplot(111) / // /# Set the x-axis limit / /#ax.set_xlim(-1,100) / /ax.set_xlim(0,len(coverages)) / /#ax.set_ylim(0,3) / /ax.yaxis.grid(True, linestyle='-', which='major', color='grey', alpha=0.5) / // /ind = range(len(coverages)) / /rects = ax.bar(ind, coverages, width=0.1, align='center', color='thistle') / /ax.set_xticks(ind) / /#ax.set_xticklabels(contig_names)/ /#ax.tick_params(axis='both', which='major', labelsize=10)/ /#ax.tick_params(axis='both', which='minor', labelsize=8)/ / / / / /#function to auto-rotate the x axis labels/ /fig.autofmt_xdate()/ /plt.setp(ax.get_xticklabels(), fontsize=8, rotation='vertical')/ /plt.show()/ How is it possible to get big charts? It looks like you are trying to make a figure that is 460 inches by 4 inches. How do you expect to display or print it? I think displaying it is out of the question, so you would need to use a non-interactive backend. I don't know whether ps or pdf can handle those sorts of dimensions. Eric Thank you in advance. If you have that much data, a bar chart is probably not the way to go. Maybe try taking the height of what would be each bar and using that as a y-coordinate array then call plt.plot(y)? You'll get a line plot, and the x axis may not make a huge amount of sense, but at least you'll see all your data. Or, perhaps even a histogram? It's hard to advise without knowing your application, but that should help at least a little. Good luck! Best wishes, Damon -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev
Re: [Matplotlib-users] imlim in ax.imshow
On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye kmichael@gmail.com wrote: On Oct 2, 2012, at 11:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye kmichael@gmail.com wrote: On Oct 2, 2012, at 6:33 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye kmichael@gmail.com wrote: Hi! I see that the function ax.imshow takes the parameter 'imlim' but in the source (status: EPD 7.3-2) it is not being used? So what is it for? Best regards, Michael Confirmed. I don't see imlim anywhere except in the imshow() signature. I have no recollection of this parameter, so it might be from before my time. Ben Root Is there some functionality you were looking for or were you just exploring the codebase? How nice of you to ask! ;) Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot? Michael -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom Is the 'extent' keyword what you're looking for? No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty. I don't understand what you mean by 'beauty'. If your image is 100 pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50] that doesn't do what you want? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imlim in ax.imshow
On Tue, Oct 2, 2012 at 8:07 PM, K.-Michael Aye kmichael@gmail.com wrote: On Oct 2, 2012, at 12:06 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 2, 2012 at 8:00 PM, K.-Michael Aye kmichael@gmail.com wrote: On Oct 2, 2012, at 11:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 2, 2012 at 5:51 PM, K.-Michael Aye kmichael@gmail.com wrote: On Oct 2, 2012, at 6:33 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Oct 2, 2012 at 2:19 PM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Oct 1, 2012 at 7:20 PM, Michael Aye kmichael@gmail.com wrote: Hi! I see that the function ax.imshow takes the parameter 'imlim' but in the source (status: EPD 7.3-2) it is not being used? So what is it for? Best regards, Michael Confirmed. I don't see imlim anywhere except in the imshow() signature. I have no recollection of this parameter, so it might be from before my time. Ben Root Is there some functionality you were looking for or were you just exploring the codebase? How nice of you to ask! ;) Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot? Michael -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom Is the 'extent' keyword what you're looking for? No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty. I don't understand what you mean by 'beauty'. If your image is 100 pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50] that doesn't do what you want? As I wrote, that's not what is happening. I get extent=[-10,110,0,50]. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom The following script works for me: import numpy as np import matplotlib.pyplot as plt image = np.random.random((100,50)) fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.imshow(image, extent=[0,100,0,50]) plt.show() -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imlim in ax.imshow
On Tue, Oct 2, 2012 at 8:33 PM, Michael Aye kmichael@gmail.com wrote: How nice of you to ask! ;) Indeed: I had the case that image arrays inside an ImageGrid where shown with some white overhead area around, e.g. for an image of 100 pixels on the x-axis, the imshow resulted in an x-axis that went from -10 to 110. I was looking for a simple way to suppress that behavior and let imshow instead use the exact image extent. I believe that the plot command has such a flag, hasn't it? (I.e. to use the exact xdata range and not try to beautify the plot? Michael Is the 'extent' keyword what you're looking for? No, because it needs detail. I was looking for a boolean switch that basically says: Respect the data, not beauty. I don't understand what you mean by 'beauty'. If your image is 100 pixels wide and 50 pixels tall, what is it about extent=[0,100,0,50] that doesn't do what you want? As I wrote, that's not what is happening. I get extent=[-10,110,0,50]. The following script works for me: import numpy as np import matplotlib.pyplot as plt image = np.random.random((100,50)) fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.imshow(image, extent=[0,100,0,50]) plt.show() I think the problem is that Michael is using ImageGrid, and apparently it is not using the tight autoscaling that imshow normally uses by default. I might have confused where I had the problem as I was trying out many a'things yesterday, so today I only can reproduce it with subplots. Can I activate tight autoscaling somehow? tight_layout only influences the axes towards each-other not the imshows itself. Eric -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users I think you may have encountered a bug, as Ben pointed out. Here's a workaround: import matplotlib matplotlib.use('macosx') import matplotlib.pyplot as plt from numpy import arange, array arr = arange(1).reshape(100,100) l = [arr,arr,arr,arr] narr = array(l) axes = [] fig = plt.figure() for i in range(4): axes.append(fig.add_subplot(2, 2, i)) for ax, im in zip(axes, narr): ax.imshow(im, extent=[0,100,0,100]) plt.show() -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bug with bar graph when plotting zero values?
On Thu, Sep 27, 2012 at 1:07 PM, Benjamin Root ben.r...@ou.edu wrote: On Thursday, September 27, 2012, Pierre Haessig wrote: Hi Paul, Le 26/09/2012 18:14, Paul Tremblay a écrit : I noticed today that when I create a bar graph with zero values that the labels don't align correctly: When I run your code with defects = [0, 0, 0, 5, 6, 7], I don't notice a misalignment of xlabels, but rather a issue with xaxis scaling being different (and not very good). So it would be more an issue of xaxis autoscaling. Maybe you can send a link to your saved figure to check we are talking of the same thing. I've attached my figures (manual 3 panels composition). Also, I've noticed that the xscaling issue doesn't come from zero values in general, but from defects[0] being zero. Best, Pierre This issue has been mentioned before. The problem happens for a zero bar on either end. Particularly, a bar with zero height does not register a bbox for determining the axis limits. We will likely need a slightly different way of autoscaling for bar() Ben Root As an epic hack/workaround. Could you set bars of zero height to instead be of height, 10e-5. Or something small compared to whatever the current scale on the y-axis is. Or call ax.set_xlim yourself after plotting? It's not ideal, but does it help? Like Ben said, the bbox should account for all possible bar locations, regardless of height, for this to behave as expected. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Tex-style factorial ! in legend
On Tue, Sep 25, 2012 at 11:10 AM, andreasl andre...@lavabit.com wrote: Hello, When I use something along the lines of legend( (r'$0.5^x/x!$', r'$1^x/x!$') ) for some reason omegas are drawn instead of the ! sign. I can't find an alternative here nor elsewhere. Any ideas? Looks fine to me. Do you have rcParams['text.usetex']=True? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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
[Matplotlib-users] How to remove an element from cbook.Grouper()
Hi, I'm playing with cbook.Grouper(), and I see that join() adds elements. How do I remove elements? Best, Damon -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] netcdf4-python build
On Friday, September 21, 2012, Michael Rawlins wrote: After the build, I determined that 'install' was also needed. python setup.py install completed with no errors. OK, finally built and installed. But now my matplotlib script gives this error: Traceback (most recent call last): File map_PrcpBias_Northeast.py, line 21, in module from netCDF4 import Dataset as NetCDFFile ImportError: /usr/local/lib/python2.7/dist-packages/netCDF4.so: undefined symbol: nc_inq_var_endian So, checking shared library dependencies: ldd /usr/local/lib/python2.7/dist-packages/netCDF4.so linux-gate.so.1 = (0xb776a000) libnetcdf.so.7 = /usr/local/lib/libnetcdf.so.7 (0xb7604000) libpthread.so.0 = /lib/i386-linux-gnu/libpthread.so.0 (0xb75d3000) libc.so.6 = /lib/i386-linux-gnu/libc.so.6 (0xb742d000) libm.so.6 = /lib/i386-linux-gnu/libm.so.6 (0xb7401000) /lib/ld-linux.so.2 (0xb776b000) and ldd /usr/local/lib/libnetcdf.so.7 linux-gate.so.1 = (0xb7765000) libm.so.6 = /lib/i386-linux-gnu/libm.so.6 (0xb7663000) libc.so.6 = /lib/i386-linux-gnu/libc.so.6 (0xb74be000) /lib/ld-linux.so.2 (0xb7766000) no libhdf5 there. Can this be fixed? MR From what I remember dealing with the netcdf c library, you have to explicitly set a compile flag to enable hdf5 support. That was a while ago, though. I'm not sure if things have changed. Hope this helps. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] install problem on OSX 10.8
On Friday, September 21, 2012, Benjamin Root wrote: Note: please use Reply-All to make sure the mailing list continues to get this thread. Could you do a uname -a at the command-line and give us that output? I was not aware that Apple shipped any 32-bit machines anymore. Ben Root -- Forwarded message -- From: Ranjit Chacko ran...@getaround.com javascript:_e({}, 'cvml', 'ran...@getaround.com'); Date: Fri, Sep 21, 2012 at 2:55 PM Subject: Re: [Matplotlib-users] install problem on OSX 10.8 To: Benjamin Root ben.r...@ou.edu javascript:_e({}, 'cvml', 'ben.r...@ou.edu'); I'm just cloned the repo from master yesterday, and I tried running the following script: NAME=matplotlib VERSION=v1.1.x PREFIX=$HOME cd matplotlib export LDFLAGS=-Os -arch i386 -L/usr/X11/lib export CFLAGS=-Os -arch i386 -I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include/libpng12 export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig export ARCHFLAGS=-arch i386 python setup.py build # use --prefix if you don't want it installed in the default location: python setup.py install #--prefix=$PREFIX cd .. Thanks, -Ranjit I'm not sure 10.8 supports 32-bit machines at all. Apple even dropped support for some 64-bit machines in the 10.8 release. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] overwriting suptitle?
On Sun, Sep 16, 2012 at 8:38 PM, Eric Firing efir...@hawaii.edu wrote: On 2012/09/16 8:54 AM, Benjamin Root wrote: On Sun, Sep 16, 2012 at 2:09 PM, Skipper Seabold jsseab...@gmail.com mailto:jsseab...@gmail.com wrote: Is there a way to overwrite suptitle? When using 3rd party libs that return a figure, if they set suptitle and don't give you the text object back then you can't overwrite it? This doesn't seem right to me. http://stackoverflow.com/questions/10559144/matplotlib-suptitle-prints-over-old-title Skipper Correct, this still seems to be the case. Looking at the code in figure.py, the suptitle() function just creates a text object and places it at a default location. Then it simply returns the object without saving a reference to it being a figure title. The only reference kept is in the self.texts list that it keeps. I see no reason why it has to be this way, though, and would certainly welcome a patch to fix this oversight (would make the code involving bbox_tight to be more simple, I think. OK, I guess I see the problem now: Figure.suptitle really should be able to replace a prior suptitle, and the most straightforward way to facilitate this is with an explicit reference kept by the Figure. Eric Ben Root -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Fixed in https://github.com/matplotlib/matplotlib/pull/1276. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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
[Matplotlib-users] John Hunter awarded PSF's Distinguished Service Award
All, John Hunter, lead author of matplotlib, has been awarded PSF's Distinguished Service Award. For details, see http://pyfound.blogspot.co.uk/2012/09/announcing-2012-distinctive-service.html Some of you may have already seen this. For those who haven't, it serves as a poignant reminder to the immense effort of John and the matplotlib developers over the past decade. Best, Damon -- Damon McDougall http://www.damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend(loc='best') not so great
On Wed, Sep 12, 2012 at 5:57 PM, Aronne Merrelli aronne.merre...@gmail.com wrote: On Tue, Sep 11, 2012 at 10:49 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Tue, Sep 11, 2012 at 3:34 PM, Neal Becker ndbeck...@gmail.com wrote: OK, I've attached my sanitized example ImportError: No module named pandas. Can you provide an example that doesn't depend on pandas? I was playing with this example to remove the pandas stuff, and It looks a lot like the check for the best legend location is just not accounting correctly for the multiple legend entries in this case. Here is an even more minimal example, that I think reproduces the same problem as Neal's original example. colors = ['b','g','r'] for n in range(3): plt.scatter([n,],[n,],color=colors[n]) plt.legend(['foo','foo','foo'],loc='best') Note that if you just put one legend name in there, the location is perfectly fine, it is just as it extends downward for the second and third names, that it covers over the point. FYI: Im using v1.1.0 mpl, in EPD 7.2. HTH, Aronne Aronne, thanks for taking the time to produce a nice example. I can now recreate the problem. I'm not sure how invasive it will be to fix this, so it possibly won't make it in for version 1.2, but possibly a bugfix release after the fact. For anyone who's interested, here's the github issue: https://github.com/matplotlib/matplotlib/issues/1235 -- Damon McDougall http://www.damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] linestyles in matplotlib.pyplot.plot
On Wed, Sep 12, 2012 at 11:31 PM, Goutam Paul goutam.p...@ieee.org wrote: It seems that there are only five line-styles: - (solid) – default -- (dashed) -. (dash dot) : (dotted) None or or (nothing) What if I want to have more linestyles? Say, ++, **, xx, ~~, etc. Is it possible to have user-defined linestyles? How? User-defined line styles is difficult. There is an open github issue on this topic: https://github.com/matplotlib/matplotlib/issues/346 Though, porting some of the existing markers over as linestyles would be a nice addition, I think. -- Damon McDougall http://www.damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] how to avoid import backend in the batch job?
On Mon, Sep 3, 2012 at 6:08 PM, Chao YUE chaoyue...@gmail.com wrote: Yet if I don't want to change the rc file, I guess I must change in the modules where matplotlib has been imported for the first time? If you're changing the rc file in your home directory: ~/.matplotlib/matplotlibrc then just make a copy before you change it: cd ~/.matplotlib cp matplotlibrc matplotlibrc_orig then edit matplotlibrc. Just rename matplotlibrc_orig back to matplotlibrc when you're done. -- Damon McDougall http://www.damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] how to avoid import backend in the batch job?
On Mon, Sep 3, 2012 at 10:20 PM, Chao YUE chaoyue...@gmail.com wrote: Thanks Damon, it's very clear now. I explicit set the backend as GTKAgg in my ipython user configuration file. and always set the backend to 'Agg' in my rc file. So that when I use ipython, I can see the window interactively, but when I use script, it also works :P That's an awesome idea. Glad it's working now. Chao On Mon, Sep 3, 2012 at 8:13 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: On Mon, Sep 3, 2012 at 6:08 PM, Chao YUE chaoyue...@gmail.com wrote: Yet if I don't want to change the rc file, I guess I must change in the modules where matplotlib has been imported for the first time? If you're changing the rc file in your home directory: ~/.matplotlib/matplotlibrc then just make a copy before you change it: cd ~/.matplotlib cp matplotlibrc matplotlibrc_orig then edit matplotlibrc. Just rename matplotlibrc_orig back to matplotlibrc when you're done. -- Damon McDougall http://www.damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 -- Damon McDougall http://www.damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] How to change the size of the numbers under the axis
On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote: Hello, Do you know to change the size of the numbers under the axis? import matplotlib matplotlib.rcParams['axes.labelsize'] = 12.0 Hope this helps. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] How to change the size of the numbers under the axis
On Thu, Aug 30, 2012 at 12:04:48PM -0400, Benjamin Root wrote: On Thu, Aug 30, 2012 at 11:58 AM, Fabien Lafont lafont.fab...@gmail.comwrote: There is no effect... 2012/8/30 Damon McDougall damon.mcdoug...@gmail.com On Thu, Aug 30, 2012 at 05:50:18PM +0200, Fabien Lafont wrote: Hello, Do you know to change the size of the numbers under the axis? import matplotlib matplotlib.rcParams['axes.labelsize'] = 12.0 Hope this helps. You want to modify xtick.labelsize or ytick.labelsize. By default, they are medium, but you can use a number for it as well. axes.labelsize effects the axes labels, not the labels for the ticks. Thanks for that, Ben. Apologies if I caused confusion. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] How to change the size of the numbers under the axis
On Thu, Aug 30, 2012 at 07:06:14PM +0200, Fabien Lafont wrote: I've tried also but it returns an error: matplotlib.rcParams['xticks.labelsize'] = 12.0 File C:\Python27\lib\site-packages\matplotlib\__init__.py, line 653, in __setitem__ See rcParams.keys() for a list of valid parameters.' % (key,)) KeyError: 'xticks.labelsize is not a valid rc parameter.See rcParams.keys() for a list of valid parameters.' It's actually 'xtick.labelsize'. No 's'. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] How to change the size of the numbers under the axis
On Thu, Aug 30, 2012 at 07:28:40PM +0200, Fabien Lafont wrote: Thanks, I've found the problem. I use xlabel(name of my axis, size= 30) after matplotlib.rcParams['xtick. labelsize'] = 12.0 and it cancel it! Is it possible to have a name on the axe and matplotlib.rcParams['xticks. labelsize'] = 12.0 ?? Wait a minute. What exactly are you trying to do? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] plotting a colored symbol with plot command
On Fri, Aug 24, 2012 at 02:39:12PM -0700, Michael Rawlins wrote: From: Damon McDougall damon.mcdoug...@gmail.com To: Michael Rawlins rawlin...@yahoo.com Cc: matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Friday, August 24, 2012 4:22 PM Subject: Re: [Matplotlib-users] plotting a colored symbol with plot command On Fri, Aug 24, 2012 at 09:20:47PM +0100, Damon McDougall wrote: plt.pyplot gives an error: AttributeError: 'module' object has no attribute 'pyplot' Sorry, that's my mistake. It should be plt.plot If I use plt.plot(x, y, color='g', marker='.', markersize=3.0) the dots are black. That should not happen... Have you tried some of the other colours? 'r', 'b', 'm', 'y', 'c'? Are they all black? What are you saving the file as? What is the output of: plt.get_backend() But I've found success with: plt.plot(x,y,'wo',markeredgecolor='white',markersize=3.0) so all is well. Thanks for your help. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] for a log y axis, set_major_formatter then twiny() removes the set_major_formatter
On Mon, Aug 20, 2012 at 09:13:10AM -0400, Michael Droettboom wrote: I've filed an issue for this here: https://github.com/matplotlib/matplotlib/issues/1110 I think I have sussed out what's going on here. See PR: https://github.com/matplotlib/matplotlib/pull/1145 Basically, on creating a new Axes object, if a shared axes was passed in, a copy of the current axes scale is executed. This overwrites the current formatter. Mike On 08/19/2012 05:55 PM, Eric Firing wrote: On 2012/08/19 10:31 AM, Christopher Graves wrote: Hi I do not think this is the expected behavior. First, run the following: from pylab import * plot([0,3],[0.2,0.7]) ax1 = gca() ax1.set_yscale('log') gca().yaxis.set_major_formatter(FormatStrFormatter('$%g$')) #ax2 = ax1.twiny() #ax2.set_xlim(ax1.get_xlim()) show() You will see that the y-axis is log10rithmic and axis labels are 0.1 and 1 rather than 10^-1 and 10^0, due to the use of set_major_formatter(). Now uncomment the 2 commented lines and run it again. It seems that upon applying a twiny(), the set_major_formatter() action is removed and the y-axis is now displayed as 10^-1 and 10^0. Or more likely, the y-axis is overwritten with a new y-axis present in ax2. One can add another gca().yaxis.set_major_formatter(FormatStrFormatter('$%g$')) before the show() and it works as intended. However, it seems like unexpected behavior to lose the formatting when twinning the axis to add a secondary x-axis. Any advice or agreement that this could be a bug? Yes, I think this is a bug. Eric Best, Chris -- 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 -- 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 -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] plotting a colored symbol with plot command
On Sat, Aug 25, 2012 at 07:59:52AM -0700, Michael Rawlins wrote: From: Damon McDougall damon.mcdoug...@gmail.com To: Michael Rawlins rawlin...@yahoo.com Cc: matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Saturday, August 25, 2012 4:21 AM Subject: Re: [Matplotlib-users] plotting a colored symbol with plot command On Fri, Aug 24, 2012 at 02:39:12PM -0700, Michael Rawlins wrote: From: Damon McDougall damon.mcdoug...@gmail.com To: Michael Rawlins rawlin...@yahoo.com Cc: matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Friday, August 24, 2012 4:22 PM Subject: Re: [Matplotlib-users] plotting a colored symbol with plot command On Fri, Aug 24, 2012 at 09:20:47PM +0100, Damon McDougall wrote: If I use plt.plot(x, y, color='g', marker='.', markersize=3.0) the dots are black. That should not happen... Have you tried some of the other colours? 'r', 'b', 'm', 'y', 'c'? Are they all black? What are you saving the file as? What is the output of: plt.get_backend() Yes I've tried several. All produce black dots. The output of that command is 'agg'. I use: plt.savefig('map.eps') to produce eps images. Bizarre. I am still seeing green dots. Could you provide a very minimal example for which you see black dots? It'd be nice to understand what's going on. Also, what's the output of import matplotlib print matplotlib.__version__ Thanks. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] plotting a colored symbol with plot command
Hey Michael! Welcome :) On Fri, Aug 24, 2012 at 01:00:13PM -0700, Michael Rawlins wrote: Relatively new user here. I need to place a series of white colored dots on a map. I've been able to place black dots using: plt.plot(x,y,color='k',marker='.',markersize=3.0) You can change the colour with: plt.pyplot(x, y, color='g', marker='.', markersize=3.0) That will plot a green dot. The color option in this command does not plot the chosen color, only black. The command: plt.plot(x,y,'wo') You can change the colour of the edge with the 'markeredgecolour' option, or 'mec' for short: plt.plot(x, y, 'wo', mec='w') Kablam! Big white Os with no black edge. You can also control the size of the marker there, too: plt.plot(x, y, 'wo', mec='w', markersize=10.0) places white dots with black around the edges. I see that the 'w' is for white and 'o' is for the symbol. I'd like to use the former command since that gives me control over marker size and a dot without a black edge. Lastly, it's not clear to me if I should be using plt.plot or just plot. Both work, and I don't know the difference. If you're using pylab, it doesn't matter: In [5]: print plot function plot at 0x10cddbd70 In [6]: print plt.plot function plot at 0x10cddbd70 They are *literally* the same function in memory. Hope this helps, Michael. Good luck! -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] plotting a colored symbol with plot command
On Fri, Aug 24, 2012 at 09:20:47PM +0100, Damon McDougall wrote: Hey Michael! Welcome :) On Fri, Aug 24, 2012 at 01:00:13PM -0700, Michael Rawlins wrote: Relatively new user here. I need to place a series of white colored dots on a map. I've been able to place black dots using: plt.plot(x,y,color='k',marker='.',markersize=3.0) You can change the colour with: plt.pyplot(x, y, color='g', marker='.', markersize=3.0) That will plot a green dot. The color option in this command does not plot the chosen color, only black. The command: plt.plot(x,y,'wo') You can change the colour of the edge with the 'markeredgecolour' Sorry! That should me 'markeredgecolor'. All commands are American spelling. If I had a penny for every time I got a syntax error for using British spelling, I'd have about 3 pence. option, or 'mec' for short: plt.plot(x, y, 'wo', mec='w') Kablam! Big white Os with no black edge. You can also control the size of the marker there, too: plt.plot(x, y, 'wo', mec='w', markersize=10.0) places white dots with black around the edges. I see that the 'w' is for white and 'o' is for the symbol. I'd like to use the former command since that gives me control over marker size and a dot without a black edge. Lastly, it's not clear to me if I should be using plt.plot or just plot. Both work, and I don't know the difference. If you're using pylab, it doesn't matter: In [5]: print plot function plot at 0x10cddbd70 In [6]: print plt.plot function plot at 0x10cddbd70 They are *literally* the same function in memory. Hope this helps, Michael. Good luck! -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] problem with png image
On Wed, Aug 22, 2012 at 11:28:54AM +0200, Petro wrote: Hi list. I generate some png images using matplotlib, and get very different results depending on figuresize __ from pylab import figure, plot import pylab as plt import numpy as np figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates1.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) __ the code above generates the following image: https://lh3.googleusercontent.com/-107Ducz_CA0/UDShKMtejtI/Cls/YOeahS3tQA8/s400/fit_rates1.png now if I increase a figure size parameter: __ from pylab import figure, plot import pylab as plt import numpy as np plt.ioff() from matplotlib import rcParams golden_mean = (np.sqrt(5)-1.0)/2.0# Aesthetic ratio fig_width = 5.6 # width in inches fig_height = fig_width*golden_mean# height in inches rcParams['figure.figsize']=fig_width, fig_height*3 figure() plt.subplot(2,1,1) plot(np.random.rand(10),'o') plt.subplot(2,1,2) plot(np.random.rand(10),'o') pic_name='fit_rates2.png' path_name='/home/petro/tmp/' plt.savefig(path_name + pic_name) What backend are you using? print plt.get_backend() -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] Stride size in mplot3d
On Sun, Aug 12, 2012 at 01:23:35PM -0700, jonasr wrote: Hello, i am working on some 3d stuff with plot_surface() , my problem is that i want to use a stride smaller then 1. The stride refers to the *array* stride. So a stride of 1 makes no sense. Since my data is only on an intervall from -1 to 1, in x and in y direction i want to plot a 3d grid with at least 20 lines in each direction, is there a possibility to do this ? An rstride of 1 will plot every row. A cstride of 3 will plot every 3rd column. If your data is in a 2D array of dimensions 100x100, say, then setting rstride=5 and cstride=5 will plot every 5th row and every 5th column, giving 20 lines in each direction. The kwargs rstride and cstride do not care about the domain of your data. Hope this helps. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] help me Velocity depth plot in matplotlib
On Fri, Aug 10, 2012 at 02:09:39PM +0530, satish maurya wrote: Dear All, I want to stairs plot (similar in matlab) matplotlib First i want for i data-set then multiple data-set super impose on that. I attach the figure it's showing velocity-depth stairs plots for superimpose (like hold on in matlab) large data-set. can anybody tell me how to plot that. I'm not sure I understand what you're asking. Are you asking how to make a stairplot, or are you asking how to make *multiple* plots on one set of axes? If your question is the former, matplotlib does not currently have a stairplot implementation, but it wouldn't be hard to use the usual plot() function to achieve the desired effect: Before: x = arange(0, 10, 1) y = x * (10.0 - x) plot(x, y) After: x = arange(0, 10, 1) x_m = x - 0.5 # left-hand midpoints x_p = x + 0.5 # right-hand midpoints y = x * (10.0 - x) x_all = dstack((x_m, x, x_p)).flatten() y_all = dstack((y, y, y)).flatten() plot(x_all, y_all) If your question is the latter, you can toggle the hold state just by calling hold() Hope this helps. see the figure Thank you -- *Satish Maurya* *Research Scholar* -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] New tutorial (beginner level)
On Fri, Aug 10, 2012 at 09:10:15AM -0400, Benjamin Root wrote: On Fri, Aug 10, 2012 at 8:23 AM, Nicolas Rougier nicolas.roug...@inria.frwrote: Hi all, I've just finished a new introductory tutorial for incoming Euroscipy 2012. You can find it here: http://www.loria.fr/~rougier/teaching/matplotlib/ It is based on Mike Müller tutorial from scipy lecture notes ( http://scipy-lectures.github.com/intro/matplotlib/matplotlib.html) Sources are available from: https://github.com/rougier/scipy-lecture-notes/tree/euroscipy-2012 If you've any comments or see errors... Nicolas Nice work. I haven't read through all of it yet, but I did notice a layout issue in firefox (using 10.0.4). Many of the code snippets are being placed on top of the example image. I see this behaviour too, on Chrome, version 20.0.1132.57. Tutorial looks nice, though :) -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] help me Velocity depth plot in matplotlib
On Fri, Aug 10, 2012 at 12:47:22PM +0100, Damon McDougall wrote: On Fri, Aug 10, 2012 at 02:09:39PM +0530, satish maurya wrote: Dear All, I want to stairs plot (similar in matlab) matplotlib First i want for i data-set then multiple data-set super impose on that. I attach the figure it's showing velocity-depth stairs plots for superimpose (like hold on in matlab) large data-set. can anybody tell me how to plot that. I'm not sure I understand what you're asking. Are you asking how to make a stairplot, or are you asking how to make *multiple* plots on one set of axes? If your question is the former, matplotlib does not currently have a stairplot implementation, but it wouldn't be hard to use the usual plot() function to achieve the desired effect: Actually, I discovered today that this is possible. You can use step() to achieve what you want: http://matplotlib.sourceforge.net/examples/pylab_examples/step_demo.html Before: x = arange(0, 10, 1) y = x * (10.0 - x) plot(x, y) After: x = arange(0, 10, 1) x_m = x - 0.5 # left-hand midpoints x_p = x + 0.5 # right-hand midpoints y = x * (10.0 - x) x_all = dstack((x_m, x, x_p)).flatten() y_all = dstack((y, y, y)).flatten() plot(x_all, y_all) If your question is the latter, you can toggle the hold state just by calling hold() Hope this helps. see the figure Thank you -- *Satish Maurya* *Research Scholar* -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] scatter plot individual alpha values
On Wed, Aug 08, 2012 at 05:22:49PM -0400, Tony Yu wrote: On Wed, Aug 8, 2012 at 4:34 PM, Gustavo Goretkin gustavo.goret...@gmail.com wrote: I can use the scatter function to plot an array of points and give a corresponding array of colors to set those points. Is it possible to do the same thing with alpha values? You can use a colormap with varying alpha values. Would it be possible to do something like ax.plot(x, y, color=[c1, c2, c3], alpha=[a1, a2, a3])? It doesn't seem that it's supported and that would be the 'natural' extension, in some sense. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] How to plot only a legend?
On Thu, Jul 26, 2012 at 06:05:39PM +0200, Andreas Hilboll wrote: Hi Andreas, 2012/7/26 Andreas Hilboll li...@hilboll.de: Hi, I would like to create a figure which only contains a legend, and no axes at all. I would like to manually assign the colors. I found this here: http://stackoverflow.com/a/3302666 but from there on, I'd like to remove the axes, and put the legend into three columns. If the plot attached it's fine for you it's easy: import matplotlib.pyplot as plt ax = plt.subplot() #create the axes ax.set_axis_off() #turn off the axis #do patches and labels ax.legend(patches, labels, ...) #legend alone in the figure plt.show() Cheers, Francesco That's really easy :) I could live with this solution, applying some external tool like pdfcrop to the result. Of course, it would be nicer if the PDF's page size would be exactly that of the legend (plus some margin), so that I wouldn't have to resort to external tools ... Any ideas? How about plt.savefig('roflcakes.png', bbox_inches='tight', pad_inches=0.1) Since the other artists are invisible, that should crop to just your legend. I'm assuming matplotlib updates the BoundingBox such that it doesn't include invisible artists. Cheers, A. -- 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 -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] Possible to change MPL color scheme?
On Mon, Jul 23, 2012 at 05:50:41AM +0200, klo uo wrote: Thanks for your reply Ben, On Sun, Jul 22, 2012 at 4:39 PM, Benjamin Root wrote: As for the assertion that HTML colors aren't used, that is incorrect. The named colors follow the HTML list. Here is our list: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/colors.py#L62 and here is the html list: http://html-color-codes.info/color-names/ sure that's correct, I just meant about default defined colors with abbrev color names, like 'y' (#BFBF00) in not 'yellow' (#00) etc. Are you saying the following two examples ax.plot(x, y, 'yellow') ax.plot(x, y, 'y') produce different coloured lines? Or are you saying yellow should always be #00? -- 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 -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] [matplotlib-users] How to switch colormaps
On Fri, Jul 20, 2012 at 12:14:08PM +0200, Fabien Lafont wrote: Hello everyone, Is it possible to have automaticaly more than 3 colors when Iplot a graph? When I plot it put the first in blue the second in green the third in red and the fourth in blue again. I want to use more colors to differenciate the curves. Sure. Here's an example I cooked up for you: https://gist.github.com/3150091 Hope that helps. Is it possible? Fabien -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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
[Matplotlib-users] 2D Quiver in Axes3D
Howdy all, Not sure if I'm being a giant noob, but is there any way to plot a vector field (a la quiver) on the (x, y)-plane of an Axes3D object? The behaviour I desire is exactly that of http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#filled-contour-plots But instead of a contour plot on the (x, y)-plane, I want a quiver plot there. Any ideas? Thank you :) -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] 2D Quiver in Axes3D
On Fri, Jul 20, 2012 at 10:12:43AM -0500, Benjamin Root wrote: On Fri, Jul 20, 2012 at 8:50 AM, Damon McDougall damon.mcdoug...@gmail.comwrote: Howdy all, Not sure if I'm being a giant noob, but is there any way to plot a vector field (a la quiver) on the (x, y)-plane of an Axes3D object? The behaviour I desire is exactly that of http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#filled-contour-plots But instead of a contour plot on the (x, y)-plane, I want a quiver plot there. Any ideas? Thank you :) I just tried to see if it was possible with only a few tweaks, and it revealed some limitations in the mplot3d code with respect to handling collection objects subclassed from PolyCollections (and others). Unfortunately, I don't see any immediate work-around. Could you please file a feature request? I may or may not be able to address it this weekend. Mate, you are a machine. I was thinking of tweaking myself, but it seems like since you hit a brick wall I'll wait to see if you get a branch going. When you do, I'll fork that bad boy. Thanks for following up! Ben Root -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] Combining 4 plots into one figure
On Thu, Jul 19, 2012 at 10:23:09AM +0200, Alexander Eberspaecher wrote: On Wed, 18 Jul 2012 15:50:50 -0700 Brad Malone brad.mal...@gmail.com wrote: Hi, I have a collection of 4 plots that I spent some time in constructing. They themselves include modifications of the axes labels, have rotated subplots next to them, etc. I need to be able to take these 4 plots and consolidate them into a single plot (referee suggestion to save space). Assuming you are using LaTeX to write your paper, you could use a LaTeX solution. Here are some links: http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats ftp://ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf This might be easier - and would also make your figures more reusable (for e.g. presentations). Personally, I use the subfigure package and it works really well. Also, +1 for reusable figures. The downside of the subfigure package is your latex code looks that much worse, but if the journal doesn't mind you using the subfigure package, then I recommend it. Hope that helps, Alex -- 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 -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] Combining 4 plots into one figure
On Thu, Jul 19, 2012 at 07:56:29AM -0700, Brad Malone wrote: Personally, I use the subfigure package and it works really well. Also, +1 for reusable figures. The downside of the subfigure package is your latex code looks that much worse, but if the journal doesn't mind you using the subfigure package, then I recommend it. Thanks for the comments everyone. I am giving subfigure a try now, and it seems relatively promising. The only problem is that apparently the \caption package intereferes with RevTeX. This causes me to have to use \usepackage[caption=false]{subcaption} which then apparently doesn't allow me to label the individual plots (a), (b), (c), and (d). Instead, attempting to do this creates new FIG labels at these locations (using \caption* doesn't fix this either). But maybe I can figure a workaround to this, and besides, this is a LaTeX question at this point anyway. I know this is getting off topic, but is the journal you're submitting to insisting on the RevTex style file? Most of them have their own custom style. If so, I recommend using that over RevTex. That would potentially solve your package conflict. If this doesn't work I suppose there is always just manually creating a new file with Inkscape and adding the a), b), c), and d) labels manually in there. Thanks for all the suggestions. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] [matplotlib-devel] ANN: mpltools 0.1 release
On Tue, Jul 17, 2012 at 08:21:50AM -0500, Benjamin Root wrote: On Tue, Jul 17, 2012 at 6:25 AM, todd rme toddrme2...@gmail.com wrote: On Wed, Jul 11, 2012 at 5:23 PM, John Hunter jdh2...@gmail.com wrote: On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). While it is a nice graph, I am not sure that the use case is common enough to justify a new plotting method. One can get the same result with: In [68]: x = np.linspace(0, 2 * np.pi) In [69]: y_sin = np.sin(x) In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2]) In [71]: plot(x, y_sin) Out[71]: [matplotlib.lines.Line2D object at 0x96959ec] In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red', alpha=0.5) Out[72]: matplotlib.collections.PolyCollection object at 0x962758c Admittedly the [::-1] thing is a bit counter-intuitive, but rather than adding a new plotting method, perhaps we would be better off with a helper method to create the xs and ys for fill_between xs, ys = mlab.pad_line(x, y, 0.2) fill_between(xs, ys) JDH What about adding a property to the existing errorbar to let someone change it to the filled version? This could also, potentially, be extended with other types of error bars if the need arises. -Todd Intriguing idea. I am actually quite comfortable with that. I like this idea, too. Ben Root -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] histogram withx axis dates
On Sat, Jul 14, 2012 at 01:57:13PM +0100, Mark Lawrence wrote: On 14/07/2012 13:41, William R. Wing (Bill Wing) wrote: On Jul 14, 2012, at 7:49 AM, Mark Lawrence wrote: Sorry if I've missed this in the docs but is it possible to directly plot a histogram with a date x axis or do I have to roll my own? This is critical as I'm on a diet and trying to plot my weight loss against date :) -- Cheers. Mark Lawrence. Are you sure you want a histogram - weight vs date sounds more like a simple bar graph (which matplotlib does trivially). -Bill -- 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/ You are correct, why did I say histogram when I've been looking at my own code that plots bars? Just shows that a beer free diet is no good for you :) Let's try again, is it possible to directly plot a bar chart with a date x axis or do I have to roll my own? -- Cheers. Mark Lawrence. Everything I said was not at all specific to histograms :) -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] path effects question
On Sat, Jul 14, 2012 at 04:09:48PM -0400, Benjamin Root wrote: On Saturday, July 14, 2012, John Hunter wrote: On Sat, Jul 14, 2012 at 11:48 AM, John Hunter jdh2...@gmail.comjavascript:_e({}, 'cvml', 'jdh2...@gmail.com'); wrote: I do not understand why in the following example, if I set patch_alpha=1.0, I do not see the shadow effect. I would expect to see it for the the rightmost four bars, where the original bars do not entirely occlude the shadow, so even if alpha is 1.0, there are parts of the shadow that are not behind the original bars and should still be visible. I now see that this line explains the behavior https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patheffects.py#L183 gc0.set_alpha(1.-self._patch_alpha) so maybe I should amend my question: is this desirable that the shadow alpha is 1-patch_alpha, since an alpha of 1 on the patch does not imply that there is no visible shadow? I would argue that the shadow's alpha should equal the patch's alpha. The more opaque the patch, the less light that should get through. Could there I am inclined to agree here. Should it instead be: gc0.set_alpha(self._patch_alpha)? have been an alpha blending reason for this? Ben Root -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Wed, Jul 11, 2012 at 08:33:21PM -0400, Tony Yu wrote: On Wed, Jul 11, 2012 at 2:28 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Jul 11, 2012 at 11:23 AM, John Hunter jdh2...@gmail.com wrote: On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). While it is a nice graph, I am not sure that the use case is common enough to justify a new plotting method. One can get the same result with: In [68]: x = np.linspace(0, 2 * np.pi) In [69]: y_sin = np.sin(x) In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2]) In [71]: plot(x, y_sin) Out[71]: [matplotlib.lines.Line2D object at 0x96959ec] In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red', alpha=0.5) Out[72]: matplotlib.collections.PolyCollection object at 0x962758c Admittedly the [::-1] thing is a bit counter-intuitive, but rather than adding a new plotting method, perhaps we would be better off with a helper method to create the xs and ys for fill_between xs, ys = mlab.pad_line(x, y, 0.2) fill_between(xs, ys) JDH I could definitely agree with a pad_line() function. We might want to revisit the issue of how much visibility the mlab module should get in the documentation (it currently doesn't get much at all). My whole take on mlab was that it was a left-over from the days of working around issues in NumPy and SciPy and that it was being slowly phased out. As for other possible locations, cbook feels like it is more for the devs than for the users, and adding it to pyplot would render the whole purpose of creating this function as opposed to errorfill moot. As an additional point about such a pad_line function, it should probably be nice to mirror the errorbar() functionality to allow not only a constant error, but also a N, Nx1, or 2xN array of +/- error. (note that errorbar() for the 2xN array case does -row1 and +row2). Damon: it sounds like you're volunteering to submit a PR to add this function ;) Here's the relevant bit (which should already handle the cases Ben mentions above): https://github.com/tonysyu/mpltools/blob/master/mpltools/special/errorfill.py#L54 Great. I've basically done this. I have one suggestion, though. In the case where len(zerr) == 2, you are setting zmin, zmax = zerr I think it makes more sense to set zmin, zmax = z - zerr[0], z + zerr[1] What do you think? It needs a docstring and a home (pyplot.py?). I kind of think `offset_line` is more explicit than `pad_line` (both of these are *much* better than my original `extrema_from_error_input`). Cheers, -Tony Cheers! Ben Root Best, Damon -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Wed, Jul 11, 2012 at 08:33:21PM -0400, Tony Yu wrote: On Wed, Jul 11, 2012 at 2:28 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Jul 11, 2012 at 11:23 AM, John Hunter jdh2...@gmail.com wrote: On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). While it is a nice graph, I am not sure that the use case is common enough to justify a new plotting method. One can get the same result with: In [68]: x = np.linspace(0, 2 * np.pi) In [69]: y_sin = np.sin(x) In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2]) In [71]: plot(x, y_sin) Out[71]: [matplotlib.lines.Line2D object at 0x96959ec] In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red', alpha=0.5) Out[72]: matplotlib.collections.PolyCollection object at 0x962758c Admittedly the [::-1] thing is a bit counter-intuitive, but rather than adding a new plotting method, perhaps we would be better off with a helper method to create the xs and ys for fill_between xs, ys = mlab.pad_line(x, y, 0.2) fill_between(xs, ys) JDH I could definitely agree with a pad_line() function. We might want to revisit the issue of how much visibility the mlab module should get in the documentation (it currently doesn't get much at all). My whole take on mlab was that it was a left-over from the days of working around issues in NumPy and SciPy and that it was being slowly phased out. As for other possible locations, cbook feels like it is more for the devs than for the users, and adding it to pyplot would render the whole purpose of creating this function as opposed to errorfill moot. As an additional point about such a pad_line function, it should probably be nice to mirror the errorbar() functionality to allow not only a constant error, but also a N, Nx1, or 2xN array of +/- error. (note that errorbar() for the 2xN array case does -row1 and +row2). Damon: it sounds like you're volunteering to submit a PR to add this function ;) Here's the relevant bit (which should already handle the cases Ben mentions above): https://github.com/tonysyu/mpltools/blob/master/mpltools/special/errorfill.py#L54 It needs a docstring and a home (pyplot.py?). I kind of think `offset_line` is more explicit than `pad_line` (both of these are *much* better than my original `extrema_from_error_input`). Cheers, -Tony Cheers! Ben Root Woohoo! Something other than my thesis to do! I have one question. It looks like your function `extrema_from_error_input` just adds +/- an error scalar (or array), but in the gallery it looks like the padding is thinner in the areas of the `sin` function where the magnitude of the gradient is larger. Is this the case, or am I missing something? -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Thu, Jul 12, 2012 at 09:41:32AM -0400, Tony Yu wrote: On Thu, Jul 12, 2012 at 9:28 AM, Damon McDougall damon.mcdoug...@gmail.comwrote: On Wed, Jul 11, 2012 at 08:33:21PM -0400, Tony Yu wrote: On Wed, Jul 11, 2012 at 2:28 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Jul 11, 2012 at 11:23 AM, John Hunter jdh2...@gmail.com wrote: On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). While it is a nice graph, I am not sure that the use case is common enough to justify a new plotting method. One can get the same result with: In [68]: x = np.linspace(0, 2 * np.pi) In [69]: y_sin = np.sin(x) In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2]) In [71]: plot(x, y_sin) Out[71]: [matplotlib.lines.Line2D object at 0x96959ec] In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red', alpha=0.5) Out[72]: matplotlib.collections.PolyCollection object at 0x962758c Admittedly the [::-1] thing is a bit counter-intuitive, but rather than adding a new plotting method, perhaps we would be better off with a helper method to create the xs and ys for fill_between xs, ys = mlab.pad_line(x, y, 0.2) fill_between(xs, ys) JDH I could definitely agree with a pad_line() function. We might want to revisit the issue of how much visibility the mlab module should get in the documentation (it currently doesn't get much at all). My whole take on mlab was that it was a left-over from the days of working around issues in NumPy and SciPy and that it was being slowly phased out. As for other possible locations, cbook feels like it is more for the devs than for the users, and adding it to pyplot would render the whole purpose of creating this function as opposed to errorfill moot. As an additional point about such a pad_line function, it should probably be nice to mirror the errorbar() functionality to allow not only a constant error, but also a N, Nx1, or 2xN array of +/- error. (note that errorbar() for the 2xN array case does -row1 and +row2). Damon: it sounds like you're volunteering to submit a PR to add this function ;) Here's the relevant bit (which should already handle the cases Ben mentions above): https://github.com/tonysyu/mpltools/blob/master/mpltools/special/errorfill.py#L54 It needs a docstring and a home (pyplot.py?). I kind of think `offset_line` is more explicit than `pad_line` (both of these are *much* better than my original `extrema_from_error_input`). Cheers, -Tony Cheers! Ben Root Woohoo! Something other than my thesis to do! I have one question. It looks like your function `extrema_from_error_input` just adds +/- an error scalar (or array), but in the gallery it looks like the padding is thinner in the areas of the `sin` function where the magnitude of the gradient is larger. Is this the case, or am I missing something? -- Damon McDougall Yep, that's the way it should look because it's adding the error just in the y-direction. To get a constant thickness, you'd have to add a constant orthogonal to the line's slope. Good luck procrastinating on your thesis ;) -Tony Aha, the answer was 'yes, I was missing something'! :) Thanks. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] Font in figures
On Thu, Jul 12, 2012 at 03:53:28PM +0200, David Kremer wrote: Hello, I want to ask some questions about fonts in figures. I think that the best figures are achieved when the font used is the same as in the surrounding text in all the figure. This is the case when I use the latex notation (between $$), but unfortunately the police used for the axis is not the same (this is sans-serif font). On the other hand, you could have a sans-serif font in your document, and thus you would like your equations to be also sans-serif as far it is possible. The reason I write to this mailing is because I want to know if it exists general recipes to have the same font in all the figure with matplotlib. The first thing I thought about as a general recipie is to use an 'epslatex' output, which is then compiled with latex to give an eps or a pdf file, but I am not sure if it is possible to achieve such a result. If you have some idea about that, let me know. Thanks, David -- 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 Hi David, Have you set usetex=True in your rcParams? -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] histogram scaling
On Thu, Jul 12, 2012 at 10:42:59AM -0400, Alan G Isaac wrote: This is essentially a query about why certain histogram types are not offered. I can see two possible answers: haven't gotten to them, or, don't want to offer them (e.g., they're bad practice). I will choose Stata as a point of comparison. http://www.stata.com/help.cgi?hist The types are density, fraction, frequency, and percent. Frequency corresponds of mpl's normed=False. Density corresponds of mpl's normed=True. Today I wanted the 'fraction' type, but mpl did not offer it. (Note that because of other elements of the graph, hacks like replacing the ticklabels won't work nicely.) If there is not sentiment against offering these types, I suggest that the `normed` keyword accept strings, including fraction and percent, and that `hist` be extended to produce these types. Cheers, Alan Isaac -- 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 +1. I think this adds more flexbility to the current histogram implementation. I wonder whether this would be worth a pull request? -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Wed, Jul 11, 2012 at 08:33:21PM -0400, Tony Yu wrote: On Wed, Jul 11, 2012 at 2:28 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Jul 11, 2012 at 11:23 AM, John Hunter jdh2...@gmail.com wrote: On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). While it is a nice graph, I am not sure that the use case is common enough to justify a new plotting method. One can get the same result with: In [68]: x = np.linspace(0, 2 * np.pi) In [69]: y_sin = np.sin(x) In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2]) In [71]: plot(x, y_sin) Out[71]: [matplotlib.lines.Line2D object at 0x96959ec] In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red', alpha=0.5) Out[72]: matplotlib.collections.PolyCollection object at 0x962758c Admittedly the [::-1] thing is a bit counter-intuitive, but rather than adding a new plotting method, perhaps we would be better off with a helper method to create the xs and ys for fill_between xs, ys = mlab.pad_line(x, y, 0.2) fill_between(xs, ys) JDH I could definitely agree with a pad_line() function. We might want to revisit the issue of how much visibility the mlab module should get in the documentation (it currently doesn't get much at all). My whole take on mlab was that it was a left-over from the days of working around issues in NumPy and SciPy and that it was being slowly phased out. As for other possible locations, cbook feels like it is more for the devs than for the users, and adding it to pyplot would render the whole purpose of creating this function as opposed to errorfill moot. As an additional point about such a pad_line function, it should probably be nice to mirror the errorbar() functionality to allow not only a constant error, but also a N, Nx1, or 2xN array of +/- error. (note that errorbar() for the 2xN array case does -row1 and +row2). Damon: it sounds like you're volunteering to submit a PR to add this function ;) Here's the relevant bit (which should already handle the cases Ben mentions above): https://github.com/tonysyu/mpltools/blob/master/mpltools/special/errorfill.py#L54 It needs a docstring and a home (pyplot.py?). I kind of think `offset_line` is more explicit than `pad_line` (both of these are *much* better than my original `extrema_from_error_input`). There was talk of this living in mlab or cbook. Is there a preference? Cheers, -Tony Cheers! Ben Root -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 05:36:50PM -0400, Tony Yu wrote: On Tue, Jul 10, 2012 at 1:52 PM, John Hunter jdh2...@gmail.com wrote: On Tue, Jul 10, 2012 at 12:49 PM, Damon McDougall damon.mcdoug...@gmail.com wrote: Would there be any interest in porting some of that functionality into the main mpl codebase? Like Ben said, that error function is nifty... :) I also think the styles would be widely appreciated, and we might get more styles contributors if it was part of the mainline. We'd ideally like to be able to support remote styles, eg via gist. Nice stuff, Tony. Damon and John: Thanks for your interest. I would be happy to help port anything that can find a home in Matplotlib. I'm low on bandwidth, so if I'm too slow with any of it, feel free to grab the code and submit your own PR for the port (just let me know so we don't duplicate our efforts). Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Wed, Jul 11, 2012 at 10:23:32AM -0500, John Hunter wrote: On Wed, Jul 11, 2012 at 10:09 AM, Damon McDougall damon.mcdoug...@gmail.com wrote: Well, as Ben said, that error fill plot is neato! It doesn't look too complicated, either. I'd be more than happy to port it over later today when I get bored of typing up my thesis. It'll probably only take me about 30 minutes. If nobody is opposed to this idea, I'll go ahead and submit a PR this evening (British Summer (hah!) Time). While it is a nice graph, I am not sure that the use case is common enough to justify a new plotting method. One can get the same result with: In [68]: x = np.linspace(0, 2 * np.pi) In [69]: y_sin = np.sin(x) In [70]: err = np.concatenate([y_sin + 0.2, y_sin[::-1] - 0.2]) In [71]: plot(x, y_sin) Out[71]: [matplotlib.lines.Line2D object at 0x96959ec] In [72]: fill_between(np.concatenate([x, x[::-1]]), err, facecolor='red', alpha=0.5) Out[72]: matplotlib.collections.PolyCollection object at 0x962758c Admittedly the [::-1] thing is a bit counter-intuitive, but rather than adding a new plotting method, perhaps we would be better off with a helper method to create the xs and ys for fill_between xs, ys = mlab.pad_line(x, y, 0.2) fill_between(xs, ys) JDH +1 on the helper function. That's probably a much less bloated of way of doing it. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] [matplotlib-users] How to plot digamma function (psi)
On Tue, Jul 10, 2012 at 12:27:59PM +0200, Fabien Lafont wrote: Hello everyone, I try to plot the digamma function of (1/2 + 1/x) but I'm not sure that I'm plotting the good one. I've tried: special.polygamma(0, (1/2 + 1/x)) and special.polygamma(1, (1/2 + 1/x)) You want special.polygamma(0, (1/2 + 1/x)). See http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.polygamma.html The number specifies which derivative of the digamma function you want. Surely you want the 0th derivative? But It returns zero division error even when x is in ]0,1] I think it blows up at x = 0. What is the type of x in your usecase? Is it an array? If x contains the element 0, you will get a zero division error. You could try plotting the points explicitly: from numpy import linspace from pylab import * x = linspace(0.5, 2, num=100, endpoint=True) y = special.polygamma(0, (1/2 + 1/x)) plot(x, y) show() You can compare output against this: http://www.wolframalpha.com/input/?i=digamma%281%2F2+%2B+1%2Fx%29+between+0.5+and+2 Hope this helps. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] [matplotlib-users] How to plot digamma function (psi)
On Tue, Jul 10, 2012 at 08:57:24AM -0400, Benjamin Root wrote: On Tue, Jul 10, 2012 at 7:05 AM, Damon McDougall damon.mcdoug...@gmail.comwrote: On Tue, Jul 10, 2012 at 12:27:59PM +0200, Fabien Lafont wrote: But It returns zero division error even when x is in ]0,1] I think it blows up at x = 0. What is the type of x in your usecase? Is it an array? If x contains the element 0, you will get a zero division error. You could try plotting the points explicitly: Another problem might be the 1/2 part, which in python2.x would yield 0 unless one does from __future__ import division. Ben Root Wow, I can't believe I didn't spot that. Nice one. I will update my answer according to Ben's astute observation: from scipy import special from pylab import * x = linspace(0.5, 2.0, num=100, endpoint=True) y = special.polygamma(0, 0.5 + 1.0/x) plot(x, y) show() Thanks Ben. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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] ANN: mpltools 0.1 release
On Tue, Jul 10, 2012 at 01:44:41PM -0400, Tony Yu wrote: On Tue, Jul 10, 2012 at 1:10 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Jul 10, 2012 at 12:58 PM, Tony Yu tsy...@gmail.com wrote: Announcement: mpltools 0.1 == mpltools is a package of tools for matplotlib. For the most part, these tools are only loosely-connected in functionality, but there are two that may prove particularly useful: Styles and plot2rst --- The `style` package provides a simple way to define and reuse matplotlibrc-like config files. For example, there's an included style that mimics R's plotting package, ggplot. You can use this style by calling:: from mpltools import style style.use('ggplot') (Thanks to Huy Nguyen for these settings.) The second tool of note is `plot2rst`, which provides a simple way to generate (Sphinx-flavored) reStructuredText examples from normal python files. See the Getting Started page and `plot2rst` example for details: http://tonysyu.github.com/mpltools/getting_started.html http://tonysyu.github.com/mpltools/auto_examples/sphinx/plot_plot2rst.html Other tools --- This package provides other tools for tweaking colors, layouts, etc. The easiest way to get started is to look at the example gallery: http://tonysyu.github.com/mpltools/auto_examples/index.html Download You can grab the 0.1 release on PyPI: http://pypi.python.org/pypi/mpltools/0.1 or clone the repo on github: https://github.com/tonysyu/mpltools.git Contributors Thanks the following people for reporting bugs and contributing fixes and enhancements: - Alex Arsenovic - Guillaume Calmettes - Huy Nguyen - Sergey Karayev Special thanks to Alex, who came up with an early implementation of stylesheets that started me down this path. Neat work, Tony! I especially like the errorfill feature: http://tonysyu.github.com/mpltools/auto_examples/special/plot_errorfill.html#example-special-plot-errorfill-py Ben Root Thanks Ben! Like a lot of things in the package, that's a fairly simple function, but I just wanted a simple interface to do it. Cheers, -Tony Would there be any interest in porting some of that functionality into the main mpl codebase? Like Ben said, that error function is nifty... :) -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- 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
[Matplotlib-users] Axes.fill_between() for two arbitrary curves
Hi, I have two arrays of coordinates in the x-y plane, z_1 and z_2. The array z_1 encloses a closed, convex and simply connected region (not a circle). The array z_2 encloses another object that is also closed, convex and simply connected. The region enclosed by z_2 is contained entirely within the region described by z_1. The picture in your head should be of one blob inside another. I want to use Axes.fill_between() to fill the 'annulus' region. This is the region containing points that are enclosed by z_1, but not by z_2. Is this possible? I've tried fiddling with the 'where' kwarg to no avail. Since they are not circles, I figured this is a no-go with the current matplotlib Axes.* functions. Is my best bet to build a PolyCollection or a matplotlib.patch and add it to the axes myself? Any help is greatly appreciated. Thank you. -- Damon McDougall d.mcdoug...@warwick.ac.uk (mailto:d.mcdoug...@warwick.ac.uk) http://damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug in Triangulation causes infinite loop if 4 or more duplicate points are used in tricontour()
Hi Kacper, Just to be clear, is it tri.Triangulation(x, y) that hangs, or is it plt.tricontour(…)? -- Damon McDougall d.mcdoug...@warwick.ac.uk (mailto:d.mcdoug...@warwick.ac.uk) http://damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom On Monday, 16 April 2012 at 14:28, Kacper Kowalik wrote: Hi, I haven't been able to pin point it exactly but following script: import matplotlib.pyplot as plt import matplotlib.tri as tri import numpy as np from numpy.random import uniform, seed seed(0) npts = 200 x = uniform(-2,2,npts) y = uniform(-2,2,npts) z = x*np.exp(-x**2-y**2) y[1:3] = x[0] # 4 or more duplicate points make tricontour hang!!! x[1:3] = y[0] triang = tri.Triangulation(x, y) plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') plt.show() causes infinite loop in _tri.so. It happens in matplotlib-1.1.0 as well as git HEAD. I understand that my input is not exactly valid, but I'd rather see MPL die than occupy my box for eternity ;) Best regards, Kacper -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net (mailto:Matplotlib-users@lists.sourceforge.net) https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug in Triangulation causes infinite loop if 4 or more duplicate points are used in tricontour()
On Monday, 16 April 2012 at 16:34, Kacper Kowalik wrote: On 16 Apr 2012 22:31, Damon McDougall d.mcdoug...@warwick.ac.uk (mailto:d.mcdoug...@warwick.ac.uk) wrote: Hi Kacper, Just to be clear, is it tri.Triangulation(x, y) that hangs, or is it plt.tricontour(…)? It's plt.tricontour that hangs, tri.Triangulation properly issues warning about duplicates. Cheers, Kacper On Monday, 16 April 2012 at 14:28, Kacper Kowalik wrote: Hi, I haven't been able to pin point it exactly but following script: import matplotlib.pyplot as plt import matplotlib.tri as tri import numpy as np from numpy.random import uniform, seed seed(0) npts = 200 x = uniform(-2,2,npts) y = uniform(-2,2,npts) z = x*np.exp(-x**2-y**2) y[1:3] = x[0] # 4 or more duplicate points make tricontour hang!!! x[1:3] = y[0] You should call z = x*np.exp(-x**2-y**2) _before_ changing the points you're triangulating. Having said that, I see the same behaviour even if I change the vertices before I compute z. triang = tri.Triangulation(x, y) plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') plt.show() causes infinite loop in _tri.so. It happens in matplotlib-1.1.0 as well as git HEAD. I understand that my input is not exactly valid, but I'd rather see MPL die than occupy my box for eternity ;) Best regards, Kacper I think the reason it's hanging is because you're trying to plot the contours of a function that is defined on an invalid triangulation (edges cross at points that are not in the vertex set). I think the best way to deal with this is to write a helper function to check the triangulation is valid. If it isn't, either tri.Triangulation(x, y) should fail, or the plotter should fail. Anybody else have any suggestions? -- Damon McDougall d.mcdoug...@warwick.ac.uk (mailto:d.mcdoug...@warwick.ac.uk) http://damon.is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users