Re: [Matplotlib-users] [matplotlib-devel] License, freetype
I usually install the matplotlib binaries from pipy and I don't remember doing a separate installation of freetype. 2017-02-18 17:20 GMT+01:00 Paul Hobson: > Especially on Windows, I always install freetype from conda. > -p > > On Sat, Feb 18, 2017 at 6:24 AM, CAB wrote: >> >> Hi, Gents, >> >> Many thanks for your thoughtful responses! Freetype is indeed available >> under a BSD-like licensse. But when I tried to install freetype on my >> Windows system using the binary provided from GnuWin32, it attempts to force >> me to accept the GPL3, which I cannot. Freetype's link to another binary >> supplied by GTK+ is broken. So, I guess I have two choices; compile >> freetype from the source, or download something like Anaconda, which I'd >> rather not do because I have Python already installed. >> >> If you have any other ideas, I'd be happy to hear them. >> >> Best, >> Chad >> >> >> >> From: Joe Kington >> To: Paul Hobson >> Cc: CAB ; Matplotlib Development List >> ; Matplotlib Users >> >> Sent: Friday, February 17, 2017 5:03 PM >> Subject: Re: [matplotlib-devel] [Matplotlib-users] License, freetype >> >> Well, if Freetype were only distributed under the GPL, you couldn't >> distribute matplotlib in binary form without providing the source code. >> >> However, Freetype is distributed under more than one license. (see: >> https://www.freetype.org/license.html ) >> >> Because it's distributed under a BSD-style license in addition to the GPL, >> it can be distributed in binary form, subject to an accreditation clause: >> http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT >> >> In the past, I have gotten approval from corporate lawyers at a very large >> company to use freetype (and matplotlib) in an application that was being >> distributed in binary form. The dual-licensing of freetype was key in that >> particular case. >> >> Or that's my take on it, anyway. I'm not a Lawyer, so don't consider this >> legal advice in any way. >> Cheers! >> -Joe >> >> On Fri, Feb 17, 2017 at 4:52 PM, Paul Hobson wrote: >> >> Chad, >> >> My recollections is that matplotlib doesn't distribute the source code to >> FreeType, it only uses it as a dependency. As such, MPL is in the clear with >> its more permissive licensing. >> -Paul >> >> On Fri, Feb 17, 2017 at 12:45 PM, CAB wrote: >> >> Hi, All, >> >> I just went to install matplotlib version 2.0.0, and it has a dependency >> called "freetype". This software appears to be licensed under GPL3. My >> reading of that latter license is that, if someone wanted to distribute a >> compiled version of a program requiring matplotlib, that entire program >> would fall under the GPL3 license. I'm sure that would be a non-starter for >> many, many projects. >> >> Does anyone have any takes on this? >> >> Chad >> >> -- -- >> -- >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> __ _ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourcef orge.net >> https://lists.sourceforge.net/ lists/listinfo/matplotlib-user s >> >> >> >> >> -- -- >> -- >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> >> __ _ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists. sourceforge.net >> https://lists.sourceforge.net/ lists/listinfo/matplotlib- devel >> >> >> >> >> > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fixing axes for imshow plot on top of a figure
I do not think fig.add_axes([0.1, 1, 1, 1]) makes any sense. The docstring says: fig.add_axes(*args, **kwargs) Add an axes at position *rect* [*left*, *bottom*, *width*, *height*] where all quantities are in fractions of figure width and height. If bottom and height are both 1 you need the height of the figure to be 2 in fractions of figure height. This means 1 must equal 2 and then Bertrand Russel must be the Pope[1]. Goyo [1] http://ceadserv1.nku.edu/longa//classes/mat385_resources/docs/russellpope.html 2015-05-20 13:43 GMT+02:00 aradand arada...@gmail.com: I'm trying to plot an image on top of a Figure, but imshow seems to always distort the size of the axes. What I want is that the lower part of the top image stay always in the same position, for any image height This minimal example shows my issue import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_axes([0.1, 0, 1, 1]) # Top figure aligned with the bottom figure # keeping the same width (?) ax2 = fig.add_axes([0.1, 1, 1, 1]) ax2.set_xticks([]) # Depending on the number of rows or columns # the top image will be moved further to the top # or will be stretched if rows columns # I dont know how to control this to stay always # with the same separation with respect # to the bottom figure and keeping the same width # (so the frame is the same width than the bottom figure) im = np.random.rand(10, 30) ax2.imshow(im) plt.plot() If it is possible to I would prefer to avoid using subplots or grid, since I have already specified a lot of things using the add_axes method. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Fixing-axes-for-imshow-plot-on-top-of-a-figure-tp45579.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installation problem
2014-07-04 8:30 GMT+02:00 Rachana Katkam katkam.rach...@gmail.com: Hey, even I had similar issue. Later I learnt python2.7 could support matplotlib version1.0.1 only. So if you want to upgrade your matplotlib, you first need to upgrade your python. matplotlib 1.3.1 works quite well with python 2.7. Goyo -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Undefined color model and inconsistencies between backends
FWIW I can't tell any difference between colors in different backends. I tried agg, cairo, several interactive backends and ipython inline in Ubuntu. Goyo 2014-05-17 6:14 GMT+02:00 Michael Goerz go...@physik.uni-kassel.de: On Fri, 16 May 2014, Eric Firing wrote: On 2014/05/16 4:41 PM, Michael Goerz wrote: While playing around for an afternoon with colors in matplotlib, I came across some inconsistencies. I was trying to define colors in sRGB (my understanding is that sRGB as a standardized color space is device-independent). Giving RGB values to matplotlib, I checked the output with a color picker -- Color Maker from the Mac App Store, set to the sRGB mode, but the built-in DigitalColor Meter gives the same result. It turns out that the colors I see in the output are not what I specified. This makes playing around with colors, a bit difficult: http://nbviewer.ipython.org/gist/goerz/9aab94f5322d5a457625 As far as I can tell, Matplotlib does not specify in which color model in interprets RGB values (this should ideally be stated in the documentation). Also, the output in different backends (IPython notebook, and interactive GUI) gave different results. As a minimal example, consider the following: Matplotlib doesn't interpret RGB values; that is left to the display device. Matplotlib simply writes the RGB values in a file, unmodified, or sends them via a GUI backend to a display, also unmodified *by mpl*. What you put in, is what it puts out. Thanks for pointing out the DigitalColor Meter--I hadn't noticed it. What I see with your example is that the MacOSX backend *display* is interpreting RGB as sRGB, and the qt4agg backend *display* is interpreting RGB as native values (based on matching with DigitalColor Meter). I haven't tried this with inline plots in the notebook, but mpl is merely feeding RGB values to the browser, just as would occur when displaying a png, and it is up to the browser to decide how to convert them into pixel intensity. I don't see that there is a bug here. Fair enough, so that would imply that there is a difference between the png streams produced by matplotlib and the direct PIL image. I might be seeing the problems discussed here: https://hsivonen.fi/png-gamma/ It might be that the matplotlib png stream is untagged, whereas the PIL image is tagged properly as sRGB. I'd have to decode the base64 data from the notebook to check this. Beyond that it seems quite tricky to understands how in a given application, or matplotlib backend in this case, a given RGB color input yields a specific output on my screen, and how to make this consistent (consistency obviously being more important than accurateness with respect to some real color model). Maybe this just goes to show what I realized these last couple of days, that colors are a huge can of worms. import pylab import numpy as np import matplotlib #%matplotlib inline # draw line with sRGB color 228, 26, 28 pylab.plot(np.linspace(0,10, 10), np.linspace(0,20,10), linewidth=10, color=(0.894, 0.102, 0.110)) pylab.show() # Colorpicker shows 210, 46, 13 in GUI view # Colorpicker shows 229, 39, 27 in iPython Notebook In the IPython notebook, direct PIL graphics do seem to give the right colors cf. In [5] in the linked IPython notebook (even though PIL also does not explicitly specify its color model). Just matplotlib seems off. Of course, I'm doing some slightly crazy stuff in the Notebook, displaying every matplotlib output through PIL, but I cecked that `%matplotlib inline` actually produces the same colors. Should I file this on github as a bug report? Best, Michael P.S.: please CC for direct replies -- Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free. http://p.sf.net/sfu/SauceLabs ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free. http://p.sf.net/sfu/SauceLabs ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to reduce the file size of plots generated with matplotlib
2014-03-22 20:23 GMT+01:00 Christopher Kuhlman ckuhl...@vbi.vt.edu: [...] For example, most recently, I am plotting 3 data sets; each data set has about 90,000 points. If I plot all three sets in one PDF figure, the file size is over 2MB. This seems absurd to me. I used R plotting for many years (again, my own homegrown code, for 6 years) and never had this issue, and I was making these kinds of plots/figures. I thought it may be a vector/raster issue, but the following web page says that PDF are generated as vector image, which, to my understanding (which could be wrong), is the more compact format. http://matplotlib.org/faq/usage_faq.html [...] Roughly speaking, size of vector files depend on the number of points while size of raster files depends on the number of pixels. For your use case (many points, small images) raster output should be more compact. Goyo -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] how to reduce the file size of plots generated with matplotlib
2014-03-22 21:38 GMT+01:00 Christopher Kuhlman ckuhl...@vbi.vt.edu: Thank you both for your fast replies. (Just an aside, plotting all the points is a quick way to detect outliers.) Before I sent the email, I tried to find a simple raster command in matplotlib to do just that (convert the image to raster), but I could not find one in my search. Is there such a thing? outfile = basefile + .png Goyo -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Access to color cycle?
2014-03-05 21:13 GMT+01:00 Adam Hughes hughesada...@gmail.com: Thanks Andreas. That is correct; however, I'd rather not make this change global. I only want a subset of my plots to have this behavior. I feel like changing the rcparams would change this globally and probably confuse users who don't know this is being called. Try using rc_context: with plt.rc_context(rc={'axes.color_cycle': ['orange', default_cycle[1::]]}): plt.plot(...) This should change the color cycle only within the scope of the with clause (not tested with this particular rcparam). Goyo -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] twinx and grid
2014-02-09 2:29 GMT+01:00 garyr ga...@fidalgo.net: The script below labels both the left and right x-axes and shows a grid. Is there a way to force the horizontal grid lines to line up with the tic marks on the left axis (ax1)? import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(111) t = np.arange(0.01, 10.0, 0.01) s1 = np.exp(t) ax1.plot(t, s1, 'b-') ax2 = ax1.twinx() s2 = np.sin(2*np.pi*t) ax2.plot(t, s2, 'r') plt.grid() plt.show() plt.grid() affects the current axes so calling it before creating the second one should do. I think it would be more consistent if you used the method ax1.grid() though. Goyo -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Memory leak when using pyplot.ion() ?
2013/10/14 Mark Lawrence breamore...@yahoo.co.uk: On 14/10/2013 13:51, OCuanachain, Oisin (Oisin) wrote: Hi, I am having problems with a script. It runs a number of iterations and plots and saves a number of plots on each iteration. After the plots have been saved I issue the pyplot.close(‘all’) command so despite many plots being created only 4 should be open at any given time which should not cause any memory problems. When I run the script however I see the RAM usage gradually growing without bound and eventually causing the script to crash. Interestingly I have found if I comment out the pyplot.ion() and pyplot.ioff() the problem vanishes. So I do have a workaround but it would still be good to have this fixed in case I forget about it in future and loose another weekend’s work. My OS is Windows XP Service Pack 3 Python 2.6 Matplotlib 1.0.1 Is this actually a matplotlib problem or could it be a Windows problem as discussed here http://bugs.python.org/issue19246 ? I think this is different. That bug report is not about RAM usage growing without bound but memory allocation failing with plenty of RAM available. Goyo -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] x axis non-uniform labeling (KURT PETERS)
2013/10/1 KURT PETERS petersk...@msn.com: here's what SHOULD be happening | 0 1 5 9 13 18 21 24 25 28 3 | x |x x | xx | x x -1|_x__x_ 12 3 4 56 7 8 9 10 How can I make that happen? Instead, MPL is autoranging the top axis. I don't want that I just want the actual labels to occur up there. Then just set the ticks and the tick labels of the axis: import numpy as np import matplotlib.pyplot as plt xdat=np.arange(1,11) simtimedata = np.array([0, 1, 5, 9, 13, 18, 21, 24, 25, 28]) idatanp = np.array([-1,0, 1, 2, 3, 2, 1, 0, -1, -2]) ax1 = plt.subplot(111) ax1.plot(xdat,idatanp) ax2 = ax1.twiny() ax2.set_xticks(range(len(xdat))) ax2.set_xticklabels(simtimedata) plt.show() Goyo -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60134791iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Broken clabel manual=True in 1.3.0
2013/9/28 Felix Patzelt fe...@neuro.uni-bremen.de: Dear all, manually placing labels when using clabel seems to be broken in Matplotlib 1.3.0. I'm on OS X 10.8.5 and have Matplotlib installed via macports. Today I updated all installed ports and thereby got the new version of Matplotlib. Now manually placing cline labels creates weird artefacts. I attached a demo script at the bottom and uploaded a screenshot at http://i.imgur.com/u6BLcRB.png . As you can see there is also a depreciation warning. Now I downgraded to Matoplotlib 1.2.1 again (keeping all other updates in place) and the problem is gone. I currently have very little time for bug hunting and therefore will just stay away from updates for a while. Maybe someone can figure out what's going wrong. FWIW, I can confirm this issue in Ubuntu Raring with the development version of matplotlib packaged in ppa:takluyver/matplotlib-daily. -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] datestr2num of year and month
2013/9/19 Mark Bakker mark...@gmail.com: Hello List, When I use datestr2num('2010-05') it nicely converts that to a number representing the date. When I convert that number back with num2date, it turns out it sets the day to the 19th of the month. The dime is 0:00:00. Any reason it is set to the 19th instead of the first? Maybe because today it the 19th, or is that just a coincidence? datestr2num calls dateutil.parser.parse, which by default uses the current date at 00:00:00 for missing fields. The dateutil function also can use a default argument to change this bahavoir but it is not available in datestr2num. http://labix.org/python-dateutil#head-a23e8ae0a661d77b89dfb3476f85b26f0b30349c Goyo -- LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib installation issues
2013/9/3 Michael Droettboom md...@stsci.edu: That's correct. We could probably do a better job reporting that to the user, though. Would you mind creating an issue for that? https://github.com/matplotlib/matplotlib/issues/2379 -- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib installation issues
2013/8/31 Dino Bektešević ljet...@gmail.com: Hello, After a little mishap from ubuntu 12.04 after which I reinstalled the OS, on this fresh install I did: sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose as per scipy stack installation instructions and everything went more or less as it should have no errors reported during installation that I saw. Keep in mind the entire install like this had ~500MB or so and I wasn't always paying attention. I ran python, and did numpy.test(), returned: Ran 3161 tests in 50.667s OK (KNOWNFAIL=3, SKIP=4) nose.result.TextTestResult run=3161 errors=0 failures=0 did scipy.test(), returned: Ran 3780 tests in 74.809s FAILED (KNOWNFAIL=11, SKIP=13, failures=2) nose.result.TextTestResult run=3780 errors=0 failures=2 I send a mail to scipy mailing list couple of days ago, but still no answer, if someone knows how bad those 2 failures are please share and then did matplotlib.test() which was disasterous: Ran 1065 tests in 284.956s FAILED (KNOWNFAIL=267, errors=772) With mpl 1.3.0 (packaged for Raring by Thomas Kluyver): Ran 1465 tests in 402.499s FAILED (KNOWNFAIL=1, SKIP=5, errors=1331) But matplotlib itself is working pretty well. The output is full with error messages like: IOError: Baseline image '/home/goyo/result_images/test_triangulation/tripcolor1-expected.svg' does not exist. It maybe that distro packages do not ship with baseline images. Looks sensible to me since there must be an awful lot of them and most users do not need them. Goyo -- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Graph ticks label missing !
2013/7/19 Nicolas Mailhot nicolas.mail...@laposte.net: Le Mer 17 juillet 2013 14:56, Michael Droettboom a écrit : Can you please provide a completely standalone example? The following code has undefined variables etc. Here it is, I'm afraid this testcase intent is less clear than what I pasted previously (I replaced variables with precomputed values) As shown in the attached png, the bottom tick labels (month names) are missing. It worked in matplotlib ≤ 1.2.0 I can confirm the issue with 1.2.1 but it works with a recent development version (output attached) so it must have been fixed at some point. Goyo attachment: test.png-- Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting right spine position to 'zero' locates spine at +1
2013/4/26 Chad Parker parker.char...@gmail.com Hi all- I've been working on a plot that puts the bottom and right spines at zero (adapting some code from the example at http://matplotlib.org/examples/pylab_examples/spine_placement_demo.html) , and I've discovered that setting the position of the right spine to 'zero' seems to locate it at x=1. Is this a bug? Or is there something that I'm missing? It looks like a bug to me, set_position('data', x) puts the spine at x + 1 instead of x. Goyo -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot_surface in pylab mode?
2013/4/2 Benjamin Root ben.r...@ou.edu: I would suggest bringing this issue up with them (that the figure gets destroyed at the end of each cell). The default behaviour of the inline backend is closing figures after cell execution, but this is configurable[1] That said you should be able to use the OO approach with oneliners like this: surf = plt.gca(projection='3d').plot_surface(...) Or write you own pyplot-style function. Adding 3d plotting functions to pyplot might or might not be a good thing, I can't tell. Or there might be a separate, pyplot-like module for 3d. Does that make sense? http://ipython.org/ipython-doc/stable/interactive/qtconsole.html#pylab-inline Goyo -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib, Tk, and multithreading
2013/3/14 Oliver King oliver.afr...@gmail.com: [...] I tried doing as you suggested [don't import Tk directly and change the backend to Agg] but it still crashes with the same TkAqua message. You must set the desired backend from the very begining and before importing pylab o pyplot. Goyo -- 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_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ticklabels
2013/3/14 Andrew H. Jaffe a.h.ja...@gmail.com: Dear all, None of the obvious ways for changing ticklabels seem to work for the current version of Matplotlib (1.2.0 for me). At present, ax.yaxis.get_ticklabels().get_text() returns empty strings, as does ax.get_yticklabels(), and the equivalent set_* functions don't seem to have any effect. It seems to be working for me. I'm using a development version but I don't thing this has changed. In [1]: import matplotlib.pyplot as plt In [2]: plt.get_backend() Out[2]: 'TkAgg' In [3]: plt.plot([1, 2]) Out[3]: [matplotlib.lines.Line2D at 0x424c310] In [4]: plt.draw() In [5]: labels = plt.gca().get_yticklabels() In [6]: map(lambda x: x.get_text(), labels) Out[6]: [u'1.0', u'1.2', u'1.4', u'1.6', u'1.8', u'2.0', u'2.2', ''] In [7]: plt.gca().set_yticklabels(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']) Out[7]: [matplotlib.text.Text at 0x3e97bd0, matplotlib.text.Text at 0x3ea2390, matplotlib.text.Text at 0x42bed90, matplotlib.text.Text at 0x42c0390, matplotlib.text.Text at 0x42c05d0, matplotlib.text.Text at 0x42c0c50, matplotlib.text.Text at 0x42c1310, matplotlib.text.Text at 0x42c1990] In [8]: map(lambda x: x.get_text(), labels) Out[8]: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] Goyo -- 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_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] confused by savefig.dpi and how can I set the dpi of jpeg format?
2013/3/11 Chao YUE chaoyue...@gmail.com: Dear all, I searched the internet but still get confused by how can I save a figure with high dpi value to jpeg format. I am using matplotlib 1.2.0 with ubuntu system. In [14]: mat.__version__ Out[14]: '1.2.0' I tried both setting the flag savefig.dpi flag in matplotlibrc as 300, and use fig.savefig('temp.jpg',dpi=300) when saving the figure. But when I checked the figure dpi with GIMP, it says 72. I can replicate this, but saving as png I get the correct dpi. I don't know if this is a bug or a limitation of the jpg format. Anyway, the jpg and png images are made of the same number of pixels hence the dpi should not be an issue provided you can scale the image in your publishing software. And the png format will do better in many cases. Goyo -- 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_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Incorrect ylabel placement in twinx
2013/1/9 Goyo goyod...@gmail.com: I'm using matplotlib master from https://launchpad.net/%7Etakluyver/+archive/matplotlib-daily, ubuntu 12.10 and python 2.7 and sometimes I get misplaced y labels for twinx plots. I file a bug at github with a sample script and figure images: https://github.com/matplotlib/matplotlib/issues/1608 A guy commented there saying he can't replicate the issue. I wonder if anyone using ubuntu 12.10 can try my code with the matplotlib version from that repo and share the output. Follow up: there's a PR for an older bug which works for me: https://github.com/matplotlib/matplotlib/issues/1608#issuecomment-12071708 -- 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. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Incorrect ylabel placement in twinx
I'm using matplotlib master from https://launchpad.net/%7Etakluyver/+archive/matplotlib-daily, ubuntu 12.10 and python 2.7 and sometimes I get misplaced y labels for twinx plots. I file a bug at github with a sample script and figure images: https://github.com/matplotlib/matplotlib/issues/1608 A guy commented there saying he can't replicate the issue. I wonder if anyone using ubuntu 12.10 can try my code with the matplotlib version from that repo and share the output. Best regards Goyo -- Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery and much more. Keep your Java skills current with LearnJavaNow - 200+ hours of step-by-step video tutorials by Java experts. SALE $49.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122612 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bug with empty values dates
2012/11/22 Jeffrey Melloy jmel...@gmail.com: I'm graphing data from a web service, and seem to have stumbled upon a bug when dates are graphed without any values. Here's a minimum repro: import datetime import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) x = [] st = datetime.datetime(2012,11,21) while st datetime.datetime(2012,11,21, 16, 00): x.append(st) st = st + datetime.timedelta(minutes=30) y = [None] * len(x) ax.plot(x,y) fig.autofmt_xdate() plt.show() The stack trace I get: Traceback (most recent call last): File min_mpl.py, line 15, in module fig.autofmt_xdate() File c:\python26\lib\site-packages\matplotlib\figure.py, line 318, in autofmt_xdate for label in ax.get_xticklabels(): File c:\python26\lib\site-packages\matplotlib\axes.py, line 2507, in get_xticklabels self.xaxis.get_ticklabels(minor=minor)) File c:\python26\lib\site-packages\matplotlib\axis.py, line 1104, in get_ticklabels return self.get_majorticklabels() File c:\python26\lib\site-packages\matplotlib\axis.py, line 1088, in get_majorticklabels ticks = self.get_major_ticks() File c:\python26\lib\site-packages\matplotlib\axis.py, line 1186, in get_major_ticks numticks = len(self.get_major_locator()()) File c:\python26\lib\site-packages\matplotlib\dates.py, line 749, in __call__ self.refresh() File c:\python26\lib\site-packages\matplotlib\dates.py, line 758, in refresh dmin, dmax = self.viewlim_to_dt() File c:\python26\lib\site-packages\matplotlib\dates.py, line 530, in viewlim_to_dt return num2date(vmin, self.tz), num2date(vmax, self.tz) File c:\python26\lib\site-packages\matplotlib\dates.py, line 289, in num2date if not cbook.iterable(x): return _from_ordinalf(x, tz) File c:\python26\lib\site-packages\matplotlib\dates.py, line 203, in _from_ordinalf dt = datetime.datetime.fromordinal(ix) ValueError: ordinal must be = 1 Adding a 0 the current date stops getting the exception, but the range seems wildly messed up. (2011 - 2014). I can't figure out what's going on here, the calls in the stack trace seem unrelated to Y data. As a quick and dirty workaround you can set the first and last Y values to 0 --won't work well if you use markers. Goyo -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is there a way to create a plot and call show() so as not to use the main Qt loop?
2012/11/4 Brickle Macho bricklema...@gmail.com: [...] When I show() a plot form within a Qt application I get the following message printed on the console: QCoreApplication::exec: The event loop is already running I think I understand the error, obviously the application I calling form control the even loop. I suppose I need to somehow supply a parent window to pylab plot or the show() function. Is there a way to create a plot and show so as not to use the main loop? Do not use show() in a GUI application. If you have a FigureCanvas instance embedded in your app, call its draw() method. If you use pyplot.figure() to create a matplotlib window from your app, call pyplot.draw(). Goyo -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] using draw_if_interactive in library plots?
2012/11/14 Skipper Seabold jsseab...@gmail.com: Hi All, Hoping someone can help me get a definitive answer to this question. Is draw_if_interactive bad to have in library plotting code? I think the only issue here is the overhead of importing the whole pyplot stuff and checking every now and then for interactive mode in code which is not mainly designed for interactive use. Something that I often do is writing non interactive plotting functions or methods and then wrappers for interactive use which call draw_if_interactive ant do other fancy things. Goyo Based on this thread [1], we've been working under the assumption that calling draw_if_interactive in plotting code is bad. Though I'm skeptical that this is the takeaway that we should have. I also asked this question on the IPython mailing list [2] since the recommendation comes from their type of usage, but I'm still not clear. I'll repeat the gist of the question here. We have plotting functions that are designed to update a given axes. I often work in interactive mode, and I'd like it if these functions updated my axes in the way that I expect (and an R user doing plotting in Python would expect). But now I'm forced to litter my user scripts with draw_if_interactive after I call a function I expect to update a plot - say updating a scatter plot with a regression line. Would be harmful to just include these draw_if_interactive calls in our plot functions. To be clear, I never have to call show or draw because I'm working in interactive mode, so the recommendation to just call show() at the end of a script is not what I want. My understanding of the pitfalls is 1) there's a performance hit to calling draw instead of just making one call. This is moot because we're only calling draw_if_interactive - so we assume the user is working interactively and actually wants to do the drawing and doesn't care about the performance hit. And 2) we are assuming that the user has imported and is using pyplot and there are possible side effects. A user wouldn't be using pyplot in a GUI or in some sort of embedded plotting framework. However, my intuition says that if this is the case, draw_if_interactive won't do anything because interactive will be False in these cases. Can someone please help clear this up? Thanks, Skipper [1] https://groups.google.com/forum/#!msg/pystatsmodels/biNlCvJPNNY/BT7bQJmOa1cJ [2] http://python.6.n6.nabble.com/IPython-User-using-matplotlib-draw-if-interactive-in-library-code-td4991275.html -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Legend Marker Color Bug
2012/8/30 Sterling Smith smit...@fusion.gat.com: Thank you for taking the time to consider my question. I'm sorry that I didn't pose my question correctly. I should have said: 'Consider the _results_ of the following script:' I originally tried to attach the results I obtained, which showed no change in color for the markers in the legend, while the line connecting the markers in the legend did change color. Actualy your question is correctly posted but I misread it. Calling set_color changes only the line color, not the markers. This is expected and documented behavoir. There are separate methods for the markers: line[0].set_markerfacecolor line[0].set_markeredgecolor See http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D Regards Goyo -- 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] Legend Marker Color Bug
2012/8/28 Sterling Smith smit...@fusion.gat.com: List, Consider the following script: import pylab pylab.plot(pylab.linspace(0,1,100),label='Test',marker='o',ls='') pylab.plot(pylab.linspace(0,1,100),label='Test2',marker='o',ls='-') leg=pylab.legend(loc='best') line=leg.get_lines() line[0].set_color('black') line[1].set_color('black') pylab.draw() I am attaching the results I see with the TkAgg baackend. I am using version 1.1.0. I would expect the markers to change colors also. However, I can't seem to find the markers recorded in the legend object to be able to change them. Is this a bug or a feature (resetting the color could lead to inconsistencies between legend and plot)? I think it's a design issue, there's no connection kept between plot lines and the legend. You can change colors in the plot an then call legend again instead. Cheers Goyo -- 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] space between bar and y-axis: works with 2 bars not with 3
2012/8/17 mgurling magurl...@gmail.com: I've attached 2.py and 3.py which differ only in how many bars are graphed. The nudge variable was intended to move the left-most bar away from the y-axis. Better use xlim to move the y-axis away from the bar: a = [20, 35] nudge = 0.2 ind = np.arange(2) + nudge width = 0.30 bar(ind, a, width) xlim(left=0) Goyo -- 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] FancyBBox set_width
2012/8/19 Peter Combs pcombs+...@gmail.com: Hi all, I'm trying to have a Text object with a fancy box, as in this example: http://matplotlib.sourceforge.net/mpl_examples/pylab_examples/fancybox_demo2.py . However, the key difference is that I want to have the box (in my case, I'm interested in an RArrow) be a specified width (in units of the plot), rather than just fitting it to the text I've given (crude ascii art below). The following seems not to work: ax = gca() txtobj = ax.text(0, -.1 * yrange, 'text', bbox=dict(boxstyle='rarrow')) txtobj.get_bbox_patch().set_ width(SIZE_IM_INTERESTED_IN) draw_if_interactive() It seems like draw()ing the text object will reset the size of the BBox... Any idea how to fix this? At the moment, I'm experimenting with continually drawing, polling the get_width() method, and when it's too small, adding in spaces around the text field, but that seems both not to work reliably, and be an incredibly boneheaded way to go about it. Not ideal but better: from pyplot import * subplot(111) text(0.1, 0.3, 'XXX', alpha=0, bbox=dict(boxstyle='rarrow')) text(0.1, 0.3, 'short') text(0.1, 0.6, 'XXX', alpha=0, bbox=dict(boxstyle='rarrow')) text(0.1, 0.6, 'looong') show() Goyo -- 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 window not showing anymore
2012/6/19 Mogliii mogl...@gmx.net: Hi, Kubuntu 12.04 with python 2.7 and matplotlib 1.1.1 Suddenly the matplotlib window does not open anymore. I tried from konsole with pyton, ipython and also from eclipse with pydev. Last time I know it worked was maybe 5 days ago, haven't tried since then. In ipython --pylab it looks like this: In [1]: plt.plot(np.arange(5)) Out[1]: [matplotlib.lines.Line2D at 0x2804fd0] In [2]: plt.show() In [3]: but no widow opens. Make sure an interactive backend is in use: plt.get_backend() I think it normally shouldn't give the object ID. Yes, it should. Goyo -- 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 window not showing anymore
2012/6/19 Goyo goyod...@gmail.com: I think it normally shouldn't give the object ID. Yes, it should. Sorry, not an object ID but a string representation of the returned object. -- 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] where did my plots go?
2012/6/19 Andre' Walker-Loud walksl...@gmail.com: But my plots still vanish as soon as the script is done : That's to be expected. You can make the script not to end until the user ask for it explicitly: raw_input('Press Enter when you are done') Goyo -- 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] suppress plotting window
2012/6/8 Maximilian Fabricius mfabric...@gmail.com: Hi all, it seems that whenever I plot something, a window opens. from matplotlib import pylab import numpy pylab.plot(numpy.random.normal(size=100)) Now, I have code that is supposed to produce diagnostic plots as PDFs. Only when I pass a command line option the script should actually open a window and also display the results on the screen. I am pretty sure that in earlier times the window would only open when I call pylab.show(). It may well be that I messed too much with my matplotlibrc, if you could just point me in the right direction ... I use matplotlib 1.0.1 on a Mac with the MacOSX backend. From http://matplotlib.sourceforge.net/faq/usage_faq.html#non-interactive-example: -- import matplotlib.pyplot as plt plt.ioff() plt.plot([1.6, 2.7]) Nothing happened–or at least nothing has shown up on the screen (unless you are using macosx backend, which is anomalous). -- Goyo -- 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] where did my plots go?
2012/6/19 Benjamin Root ben.r...@ou.edu: On Tue, Jun 19, 2012 at 2:40 PM, Andre' Walker-Loud walksl...@gmail.com wrote: Hi Goyo, 2012/6/19 Andre' Walker-Loud walksl...@gmail.com: But my plots still vanish as soon as the script is done : That's to be expected. You can make the script not to end until the user ask for it explicitly: raw_input('Press Enter when you are done') If this is expected - it is a new feature. My understanding was that changing interactive : True in the matplotlibrc file, then the plots would not vanish until explicitly closed by the user. Is my understanding incorrect? Thanks, Andre That is correct. If you have a call to show(), then the script should not finish on their own until the windows are closed -- regardless of whether or not interactive is True or False. The interactive setting should only dictate whether or not the script execution pauses or not at the call to show(). Then the script is supposed to keep itself alive, after executing the last statment, until the plot windows are closed? Does not work that way for me (tkagg, qt4agg and gtk*) and I wouldn't expect that. BTW this may be better than using raw_input: import matplotlib.pyplot as plt plt.ion() plt.plot([1.6, 2.7]) # The plot windows shows up. # Do stuff, even user interaction, more plots, etc. # ... # Wait until all plot windows are closed. plt.ioff() plt.show() Goyo -- 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 legend woes.
2012/6/13 Mike Kaufman mck...@gmail.com: On 6/13/12 3:23 PM, Steven Boada wrote: Whoops, I forgot to change the subject. Sorry list. List, I'm making a scatter plot using a for loop. Here's a simple example.. for i in range(10): x=rand() y=rand() scatter(x,y,label='point') legend() show() When you do this, you get a legend entry for every single point. In this case, I get 9 entries in my legend. Is there a way to only get a single entry? Maybe you can adapt this to your use case: for i in range(10): x=rand() y=rand() collection = scatter(x,y,label='point') legend((collection,), ('Label',)) show() Goyo -- 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] dates for x-axis
El día 19 de abril de 2012 05:31, questions anon questions.a...@gmail.com escribió: Thank you, I was able to get it to work but only if I imported datetime within the loop, otherwise I ended up with the AttributeError: type object 'datetime.datetime' has no attribute 'datetime' and if I added 'import datetime' at the top of my script it had an error where I loop through combining each month stop_month = datetime(2011, 03, 01) TypeError: 'module' object is not callable If you can write a standalone, minimal executable script which reproduces the problem I'll take a look. Send it as an attachement and add sample data files if necessary. Goyo -- 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] dates for x-axis
El día 12 de abril de 2012 03:46, questions anon questions.a...@gmail.com escribió: I am not sure how to recognise that x-axis are dates like 20110101, 20110102, 20110103 etc. Use datetime objects instead of strings. Goyo -- 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] open ascii grid data and plot
El día 21 de marzo de 2012 01:03, questions anon f=np.genfromtxt(inputfile, skip_header=6, dtype=None, names=True) I don't think you should be using dtype=None if you wand a 2D array. Also the names=True thing makes no sense to me since there isn't a row with field names. Try just this and I guess you'll get a 2D array: f=np.genfromtxt(inputfile, skip_header=6) Goyo -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] open ascii grid data and plot
El día 15 de marzo de 2012 05:14, questions anon questions.a...@gmail.com escribió: I think my error is from the np.genfromtxt because I just checked the size of my data and it appears in 1D rather than 2D. This is unsurprising since your file has just one row of data. I overlooked that because the weird error message drove all my attention to it. You can reshape the resulting array to (691, 886). Still that error message should not be there in any case. I don't really understand what np.logical_or is or how to use it? I have tried just calling it at the beginning of the script np.logical_or computes the logical out of two boolean arrays. It's called internally by countourf and that's triggering the exception: AttributeError: logical_or Which makes no sense at all because: 1. np is expected to be an alias for numpy and numpy *does* have an attribute called logical_or. 2. In case np didn't have an attribute called logical_or (for whatever reason) it would cause an exception but the error message should be something like AttributeError: 'module' object has no attribute 'logical_or'. You where asked to call np.logical_or at the beginning of the script in order to know if it triggers the exception in that context. [...] but I still end up with the same error. So the call at the beginning didn't trigger the error? Regards Goyo -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] open ascii grid data and plot
El día 12 de marzo de 2012 23:25, questions anon questions.a...@gmail.com escribió: [...] Is this how the data should look when it has been imported from an ascii to a numpy array? I can't see anything obiously wrong in your code or your data --I did not dive too deep into it though. What is weird is the traceback: Traceback (most recent call last): File d:\plotrainfall.py, line 40, in module CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet) File C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py, line 3072, in contourf np.logical_or(outsidemask,np.logical_or(ma.getmaskarray(data),xymask)) AttributeError: logical_or Is that the complete traceback? Goyo -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where is line after remove?
El día 13 de marzo de 2012 00:25, Federico Ariza ariza.feder...@gmail.com escribió: [...] I want to turn visibility on and off for lines. I can not use the visible property, using it the autolimits relim keeps considering the lines as being there. As consequence the limits are wrong (if we think only on the visible lines). I faced this some time ago and my workaround was writing my own (simplified) version of relim, if memory serves. But this may not fit your needs here. Maybe a better solution is modify relim upstream so it can take visibility into account (maybe using a new keyword). Just a quick thought. So I resorted to remove the line from its axes by line.remove() The question is: If I do not want to use another variable to keep track of this line, how can I find it again from the figure instance (or somewhere else)? get_children gets me nowhere or maybe? I don't think matplotlib keeps a reference to a line object after you remove it from the axes. If I'm right and you want to follow that path you'll need to track it yourself. Regards Goyo -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] python nltk plots are not showing up
El día 12 de marzo de 2012 17:05, Gias Uddin gia...@gmail.com escribió: I have posted the following message in StackOverflow about my problem with graph plotting using python nltk using Matplotlib and numpy. Advices will be tremendously helpful. Thanks in advance. http://stackoverflow.com/questions/9661909/python-nltk-plots-are-not-showing-up This usually happens when you're using a non interactive backend. What's the output of plt.get_backend()? Goyo -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Set various parameters of a plot window.
El día 11 de marzo de 2012 11:31, gsal salger...@gmail.com escribió: I am not quite sure what you are asking, but, can you simply just add your own attribute to the window objects? Python is friendly that way, you know? It's dynamic. There are some dialogs not accesible using the mpl api. The save dialogs seem to be the standard ones for the underlying toolkit so reading the toolkit docs may help. Then there are the subplot params configuration dialogs. Goyo -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Non-interactive plotting to window?
2011/12/15 John Thorstensen john.thorsten...@dartmouth.edu: So my question: Is there a simple way of getting matplotlib to display a plot in a window and then surrender control to the main program, without destroying the plot? Something like a method to kill mainloop would be ideal. Just make sure you use interactive mode and get rid of the show calls: import matplotlib.pyplot as plt plt.ion() # set interactive mode plt.plot(foo) # plot something bar() # do stuff while the plot is visible plt.close() # if you want to close the plot window from the script This works in mpl 1.1.0 al least with tkagg, gtkagg and qt4agg backends. Goyo -- 10 Tips for Better Server Consolidation Server virtualization is being driven by many needs. But none more important than the need to reduce IT complexity while improving strategic productivity. Learn More! http://www.accelacomm.com/jaw/sdnl/114/51507609/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] missing library animation from enthought distribution
2011/11/22 Robert Kern robert.k...@gmail.com: To get matplotlib 1.1.0 right now, you will have to build it yourself from sources. Matplotlib packages for Precise also seem to work well in Oneiric. Goyo -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] I have a problem with installation of python(x, y).
2011/11/15 Jun Tanaka tna...@gmail.com: Dear All, I have a problem with installation of python(x,y). When I try, it says python 2.6.2 msi was not found If anyone knows how to resolve this issue, please help me. My OS is windows 7 64bit. If this mailing lists does not help pyhton(x,y) issue, please lead me to a right place. Try the python(x,y) discussion group http://groups.google.com/group/pythonxy -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Inexact drawing of points
2011/11/7 Anton Daitche a.dait...@googlemail.com: Do you remember the name of the thread? I would like to understand the details on this. I can't find it right now but I guess Michael's answer helps you. I also would like to find out if i can force the renderer to do exact drawing (at some computational cost). Do you mean using an interactive backend? You can try gtkcairo and wx. I think they have their own issues though. Goyo -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Inexact drawing of points
2011/11/2 Anton Daitche a.dait...@googlemail.com: Hallo, i am observing inexact drawing of point in matplotlib. As I remember from an earlier discussion on this, it's assumed that these small deviations are tolerable in the agg renderer. This makes the interactive backends more responsive at expenses of accuracy. I can see the same deviations using the tkagg backend with mpl 1.1.0 but if I save as pdf using the save button I get an accurate rendering (see attachment). Best regards Goyo simple_example.pdf Description: Adobe PDF document -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Forcing the size of a figure
Maybe you need to call fig.canvas.draw() to get the figura actually resized. 2011/8/12, Benjamin Root ben.r...@ou.edu: On Fri, Aug 12, 2011 at 10:04 AM, David Just just.da...@mayo.edu wrote: Now that I’m pre-building all my enlarged interpolated images to scroll through, I’m having trouble forcing the figure/FigureCanvas to be the size I want. I’m trying: fig.set_size_inches(768 / 72.0, 768 / 72.0), but it ends up the same size as the default plot. Thanks, Dave Dave, Don't know if that is a bug or not (never tried that function). Typically, I just use the figsize kwarg in the figure constructor. Is it possible to do it from there, or are you looking to adjust the figure size *after* the figure has been displayed already? Ben Root -- FREE DOWNLOAD - uberSVN with Social Coding for Subversion. Subversion made easy with a complete admin console. Easy to use, easy to manage, easy to install, easy to extend. Get a Free download of the new open ALM Subversion platform now. http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Autoscaling after removing lines.
Seems like Axes.relim is what I was looking for. It does not take collections into account but I don't need that for now. 2011/8/1, Goyo goyod...@gmail.com: Hy all, I recently had a pretty hard time trying to figure out how to properly autoscale a plot after removing a line (see attached script). Finally I found at [1] that I have to explicitly refresh the axes dataLim before autoscaling. In [1] John Hunter says that computing the proper dataLim can be complicated if there are several types of artists in the axes, like polygons and collections an that [it] would be useful to have an Axes method like auto_datalim to for the datalim to readjust to all the current data. My question is whether such a function has been implemented. Besides any suggestions about how to deal with this are welcome. I just need to adjust to lines right now but this may change in the future. Best regards Goyo [1] http://old.nabble.com/Removing-a-line-from-a-plot-td7249600.html -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos much more. Register early save! http://p.sf.net/sfu/rim-blackberry-1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Autoscaling after removing lines.
Hy all, I recently had a pretty hard time trying to figure out how to properly autoscale a plot after removing a line (see attached script). Finally I found at [1] that I have to explicitly refresh the axes dataLim before autoscaling. In [1] John Hunter says that computing the proper dataLim can be complicated if there are several types of artists in the axes, like polygons and collections an that [it] would be useful to have an Axes method like auto_datalim to for the datalim to readjust to all the current data. My question is whether such a function has been implemented. Besides any suggestions about how to deal with this are welcome. I just need to adjust to lines right now but this may change in the future. Best regards Goyo [1] http://old.nabble.com/Removing-a-line-from-a-plot-td7249600.html autoscaling_issues.py Description: Binary data -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos much more. Register early save! http://p.sf.net/sfu/rim-blackberry-1___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap river plotting
2011/6/16 stefanie lue...@googlemail.com: Hello! I'm plotting the river danube and some other stuff around it. Is there an easy way to extract several rectangles around the river and plot this rectangles next to each other? My aim is to print the whole river on a paper. My idea is to cut a rectangle every 100km, turn it straight (but marking North) and put all rectangles next/under each other. Or should I plot everything and continue with an image library? You can add several maps to the print composer, then make each map show the region you want. Goyo -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Text outside the graphs box
2011/5/15 Johannes Radinger jradin...@gmx.at: How is the space between the axis and the outer margins of a figure defined? How much space is between the upper most plot and the upper end of the figure? This is the space e.g for the titles etc. but can this be space be increased? Use subplots_adjust. Goyo -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible bug / odd behaviour in GridSpec?
2011/5/12 David Andrews irbda...@gmail.com: Hi, I've come across something I don't entirely understand in the behaviour of gridspec. It's not obvious from the code docs for this module, but is it only supposed to be able to deal with 'square' layouts, e.g. 3x3, 4x4 etc? Taking some code from an example on the gridspec page ... import matplotlib.pylab as plt import matplotlib.gridspec as gridspec #gs = gridspec.GridSpec(3, 3) # OK gs = gridspec.GridSpec(6, 3) # Will cause an error later on ax1 = plt.subplot(gs[0, :]) ax2 = plt.subplot(gs[1,:-1]) ax3 = plt.subplot(gs[1:,-1]) ax4 = plt.subplot(gs[-1,0]) ax5 = plt.subplot(gs[-1,-2]) plt.show() ... will fail if that line is uncommented, giving an index error. Works for me. Ubuntu 11.04 Natty, stock python 2.7.1 and matplotlib 1.0.1 from https://launchpad.net/~valavanisalex/+archive/matplotlib. -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Asymmetrical arrangements of subplots
2011/5/5 Sebastian Krieger sebastian.krie...@usp.br: Dear all, I have a small question about subplot. I want to avoid creating plot axes manually using pylab.axes, to create an asymmetrical arrangement of subplots like the following code in Matlab: figure subplot(2,2,1:2) text(.5,.5,'subplot(2,2,1:2)',... 'FontSize',14,'HorizontalAlignment','center') subplot(2,2,3) text(.5,.5,'subplot(2,2,3)',... 'FontSize',14,'HorizontalAlignment','center') subplot(2,2,4) text(.5,.5,'subplot(2,2,4)',... 'FontSize',14,'HorizontalAlignment','center') Reference: http://www.mathworks.com/help/techdoc/ref/subplot.html Is it possible in matplotlib? Easier done than explained: import matplotlib.pyplot as plt plt.subplot(121) plt.subplot(222) plt.subplot(224) plt.show() Goyo -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Subplot x-tick labels overlap with each other and with titles
2011/5/5 Chris Rodgers chris.rodg...@berkeley.edu: 1) Is this the intended behavior of matplotlib, or is there something wrong with my installation? This is by design, hspace and vspace are proportional to the size of each subplot. Also the number of ticks does not depend on the subplot or labels size (using the default locator). So you have to fine tune if things don't fit together. Of course you can write custom subplot-like functions which take care of this the way you find more convenient. I wonder how other plotting packages deal with this. Goyo -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Date format the x-axis of a barh() plot?
2011/4/23 jfortiv jfor...@gmail.com: Hi, This actually did not work for me. Can you show me the full code that you used to successfully produce the time-format x-axis labels? See attached files. Goyo sample.py Description: Binary data attachment: sample.png-- Fulfilling the Lean Software Promise Lean software platforms are now widely adopted and the benefits have been demonstrated beyond question. Learn why your peers are replacing JEE containers with lightweight application servers - and what you can gain from the move. http://p.sf.net/sfu/vmware-sfemails___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Try to have none-overlapping labels in one axe using matshow
2011/4/23 _olivier_ olir...@gmail.com: [...] I have got a matrix 6x500 (so one size is much biggger than the other one) and I try to expand the shorter axe so that the labels on it are well displayed (not overlapped. Use the aspect kwarg in matshow. Goyo -- Fulfilling the Lean Software Promise Lean software platforms are now widely adopted and the benefits have been demonstrated beyond question. Learn why your peers are replacing JEE containers with lightweight application servers - and what you can gain from the move. http://p.sf.net/sfu/vmware-sfemails ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Linecollection, labels
2011/4/13 Tim Åberg qw...@hotmail.com: Due to that my first question a couple of day back was a mess i thougth i could clear things up. Is there any way to label the lines using linecollection. In plot there is label, example; plot(x,y,label = Hello) But are there any way to do the same thing with linecollection? If not, is there any eother asy way of creating labels on a line? You can customize the legend by hand. http://matplotlib.sourceforge.net/users/legend_guide.html Goyo -- Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error when plotting negative values on log scale
2011/3/10 Søren Nielsen soren.skou.niel...@gmail.com: Is there a way I can get around this without having to search through my data and remove points that are negative or NaN or INF when the yscale needs to be log? That would also show an incorrect curve since a line would be drawn across the points that were removed.. It should rather be gaps in the line. You can use masked arrays. Masked values don't get plotted. Sample code (not tested): import numpy.ma as ma # masked arrays module ... mdata = ma.masked_array(data) mdata[mdata = 0] = ma.masked plot(mdata) Goyo -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes formatting
2011/3/11 Luciano Fleischfresser l_...@yahoo.com: [...] I have to confess that object-oriented programming seems very counter-intuitive to me. Hopefully it will come more naturally soon. This has nothing to do with OOP, you just need to know what command/function/method does what you want. It happens that in matplotlib plots are autoscaled by default but not tightly. You can change this behavoir using autoscale. There is a functional version pyplot.autoscale but for scripting is usually better the axes.autoscale version because it make explicit in your code which axes is affected. For interactive plotting, the functional version may be more convenient. Along the same lines of my original query, this one I think is more obscure, so here it goes: Same script, just another .csv file with the same format. This time around, the plot comes up with UTC times for the labels on the x-axis. The first one came with the dates. Does anybody know how to tell matplotlib to always put dates? Matplotlib automatically choose a formatter for labels, based on the interval to plot and the like. If you don't like it, use your own. Maybe this: import matplotlib.dates as mdates formatter = mdates.DateFormatter('%d-%b-%y-%H:%M:%S') axes.xaxis.set_major_formatter(formatter) Goyo -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pyplot.figure() memory leak?
2011/3/8 Paul Anton Letnes paul.anton.let...@gmail.com: Hi! This simple loop: import time import pylab for i in range(100): ... time.sleep(0.1) ... pylab.figure() ... will have python use more and more memory. While this is not technically a memory leak, it becomes one in practice, if I want to create a large number of figure objects. How can I free the memory used by one or all figure objects? Your code creating many objects is not a memory leak. You can reuse figures or dispose of them calling pylab.close(). See docstrings for pylab.close and pylab.clf. Goyo -- What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Text box adaptable
2011/3/7 Andrea Crotti andrea.crott...@gmail.com: [...] t = matplotlib.text.Text(0, 0, very long string) t.get_bbox_patch() to get the size and then do the rest. but this still returns None, probably because at this point there's probably something still missing, right? And when I get the resulting size, how do I make my axes big enough anyway? As Ben explained you need to draw first. So the usual path is: 1. Draw 2. Figure out the size of potentially problematic things (labels, titles...) and the space you need. 3. Adjust subplots or whatever needs adjustment to fit. 4. Draw again. Sort of weird but it works and I think it's widely used. Goyo -- What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Best way to modify plot / subplot
David, the preferred way to custom plots seems to be passing an Axes instance to the plotting function. Some tricks allow use of pylab/pyplot style: def custom_plot(x, y, axes=None): ... if axes is None: axes = pyplot.gca() axes.plot(x, y) What you don't get this way is the axes.custom_plot(x, y) sintax, which requires subclassing Axes. But doing this is not common and not straighforward if you want it to work well with pyplot.subplot() and the like. Maybe monkey patching would work but well, you know... I never tried it anyway. Goyo -- Free Software Download: Index, Search Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram with single series - colour coding different ranges?
2011/2/22 Benjamin Root ben.r...@ou.edu: Admittedly, this isn't using matplotlib's hist() function because it only allows for one color per dataset. However, you can use numpy's histogram function to get the bins and counts yourself, and then use bar() to make the bars. bar() will allow you to color the bars individually. Pylab hist() returns a list of patches so you can also change their properties. Goyo -- Free Software Download: Index, Search Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting the ticks on an axis
2011/2/20 Curiouslearn curiousle...@gmail.com: Thomas and Goyo, Thanks for the answers. I am fine with them being coverted to ints. In fact, my ax.set_ylim(bottom=0, top=6000) contains ints and I don't understand why they are converted to floats. I was thinking that there is perhaps another (more correct) way to set tick values. You can use locators, but set_yticks is good enough for simple cases. http://matplotlib.sourceforge.net/api/ticker_api.html -- Index, Search Analyze Logs and other IT data in Real-Time with Splunk Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. Free Software Download: http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting the ticks on an axis
2011/2/19 Thomas Lecocq thlec...@msn.com: To avoid having the warning, you can explicitly provide ints : ax.set_yticks(range(int(ax.get_ylim()[0]), int(ax.get_ylim()[1]), 400)) I don't know any easier method of setting the ticks... Let's wait for the user community input ! If you don't want your floats converted to ints then use numpy arrange or linespace. Goyo -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] There is no plot in the PNG file. The PDF file is fine.
2011/2/9 Curiouslearn curiousle...@gmail.com Can you please see the code below and let me know why the png figure comes out empty (it only contains the x-axis, does not contain the scatterplot). The pdf file has no such problems. Seems like mpl is getting confused because of the rect argument of add_axes. Note that bottom is 0.3 and height is 0.9 so bottom + heigt 1. Maybe different backends differs handling the overflow. Does this change in line 12 fix your issue?: ax1 = fig1.add_axes([0.1, 0.3, 0.8, 0.6]) Goyo I have tried saving another usual line plot in .png format and I had no problems. Does this have to do with scatter plot and .png format? Thank you. The code import matplotlib.pyplot as plt import numpy differences = numpy.random.uniform(-2,2,190) bin_values = numpy.arange(-2,2.6,0.1) hist, bins = numpy.histogram(differences, bins = bin_values) fig1 = plt.figure() fig1.set_figwidth(6) fig1.set_figheight(3) ax1 = fig1.add_axes([0.1, 0.3, 0.8, 0.9]) ax1.patch.set_facecolor('Linen') for left, hist_val in zip(bins[:-1], hist): xvec = [left]*hist_val yvec = 0.05*numpy.arange(hist_val) + 0.1 if len(xvec) 0: ax1.scatter(xvec,yvec) ax1.axvline(1.3, ymax=0.6, color='DarkGreen') # The frame of the axes is referred to as # spines in matplotlib for i in ax1.spines.iteritems(): if i[0] in ['top','right', 'left']: i[1].set_visible(False) print i # Ticks only in bottom ax1.xaxis.set_ticks_position('bottom') ax1.yaxis.set_ticks_position('none') ax1.set_ylim(bottom=0,top=1.5) fig1.savefig('trial_figure.png', facecolor='Linen') fig1.savefig('trial_figure.pdf', facecolor='Linen') -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug in boxplot/mlab.prctile
2011/1/1 OKB (not okblacke) brenb...@brenbarn.net: I noticed that the boxplot function incorrectly calculates the location of the median line in each box. As a simple example, plotting the dataset [1, 2, 3, 4] incorrectly plots the median line at 3. It seems to work fine in matplotlib 1.0.0: u...@host:~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. import matplotlib as mpl mpl.__version__ '1.0.0' import matplotlib.pyplot as plt import matplotlib.mlab as mlab plt.ion() plt.boxplot([1, 2, 3, 4]) {'medians': [matplotlib.lines.Line2D object at 0x3ad6250], 'fliers': [matplotlib.lines.Line2D object at 0x3ad6610, matplotlib.lines.Line2D object at 0x3ad69d0], 'whiskers': [matplotlib.lines.Line2D object at 0x3acff50, matplotlib.lines.Line2D object at 0x3ad4310], 'boxes': [matplotlib.lines.Line2D object at 0x3ad4e50], 'caps': [matplotlib.lines.Line2D object at 0x3ad46d0, matplotlib.lines.Line2D object at 0x3ad4a90]} plt.grid() plt.boxplot([1, 2, 3, 4]) {'medians': [matplotlib.lines.Line2D object at 0x3dfbad0], 'fliers': [matplotlib.lines.Line2D object at 0x3dfbe90, matplotlib.lines.Line2D object at 0x3dff290], 'whiskers': [matplotlib.lines.Line2D object at 0x3df8810, matplotlib.lines.Line2D object at 0x3df8b90], 'boxes': [matplotlib.lines.Line2D object at 0x3dfb710], 'caps': [matplotlib.lines.Line2D object at 0x3df8f50, matplotlib.lines.Line2D object at 0x3dfb350]} plt.grid() # See attached image. ... mlab.prctile([1, 2, 3, 4]) array([ 1. , 1.75, 2.5 , 3.25, 4. ]) Goyo It also seems that the quartile calculations for the box are a little peculiar. I have seen some discussion in old mailing list postings about mlab.prctile and its ways of calculating percentiles, which are different than those of some other software. I'm aware that there is legitimate disagreement about the best way to calculate the quartiles. However, it seems to me that mlab's way is still not any of these possibly-correct ways, because it uses int() or nparray.astype(int) to coerce the percentile result to an integer index. This TRUNCATES the floating-point result. No accepted quantile- calculating method that I'm aware of does this; they all ROUND instead of truncating (if they want to coerce to an integer index at all, in order to produce a quantile value that is an element of the data set), or in some cases they round uniformly up for the lower quartile and down for the upper. You can see a summary of different methods at http://www.amstat.org/publications/jse/v14n3/langford.html ; the method used by mlab does not appear to agree with any of these. I would suggest that mlab.prctile be fixed to conform to some one or other of these methods, rather than adding to the proliferation of approaches to quantile-calculation. Is there any motivation for always truncating to integer (other that it's quicker to type :-)? Also, regardless of these quartile issues, there is, as far as I'm aware, no one who denies that the median of a (sorted) data set with an even number of values is the mean of the middle two values. Since numpy is already a dependency for matplotlib, boxplot shouldn't use mlab.prctile at all to decide where to plot the median line -- just use numpy.median. Thanks, -- --OKB (not okblacke) Brendan Barnwell Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail. --author unknown attachment: boxplot_sample.png-- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] starting with pplots
2010/12/19 Pawel pawe...@gmail.com: Hi, I am a new user of matplotlib so maybe my question is elementary, but have not been able to find an answer to my problem in the archive. I would like to make a 2D plot of colored points of 3D data (clusters). My data looks like this: 11837.2120 -0.0858 2. 23975.2120 -0.0672 2. 37609.2120 -0.0306 2. 53263.9800 -0.0690 2. 72106.6760 0.2708 1. 92674.6760 -0.0129 3. 116758.676 -0.1245 3. ... So I need to plot the first and second column as points on the x-y axis and color the points according to the numbers in the third column (which are integers ranging from 1 to5). I'd appreciate any help. I realize something so typical should be somewhere in the documentation but I was not able to find it. Try this: import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap x, y, z = np.loadtxt('data.txt', unpack=True) cmap = ListedColormap(['b', 'g', 'r', 'c', 'm']) plt.scatter(x, y, c=z, cmap=cmap, vmin=1, vmax=5) plt.show() You'll need to use a single space as column delimiter in your data file or deal with more loadtxt arguments. If your z data were color specifications you could just use plt.scatter(x, y, c=z) as stated in the scatter docstring. Converting arbitrary data to color specifications is the non trivial issue here. You can write your own code to do this or use colormaps. Goyo -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] unable to point pick 2nd axis after upgrade to mpl 1.0
2010/12/9 C M cmpyt...@gmail.com: I have created a runnable sample app that demonstrates the problem Here is a much simpler 10 line sample that doesn't require wxPython and demonstrates the problem: you can't pick the red line. This seems like a bug in mpl 1.0. Confirmed using tkagg, mpl 1.0.0 and Ubuntu 10.10. I do not know much about the semantics of the pick event but it I don't think it should discriminate between lines in the same canvas si I guess it's a bug. Goyo -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Limit legend to visible data
2010/12/3 Justin McCann jne...@gmail.com: On Wed, Dec 1, 2010 at 11:58 AM, Justin McCann jne...@gmail.com wrote: This seems to do the trick, but might be a bit too clever. I'm not sure if get_children() (or findobjs) is the right call to retrieve all the plot elements. If you are just looking for line2D instances then use ax.get_lines(). Goyo -- What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Scatter Plot with different colors
2010/10/10 Alessio Civ viandant...@gmail.com: Please, can someone help me? I've been digging the documentation, but I can't find a way to do this. ¿Didn't you get my message on oct-5? I didn't send it to the list by mistake: --% Make your variables numpy arrays and slice them using values in z: x = np.array([1, 2, 3, 4]) y = np.array([2, 3, 4, 5]) z = np.array([0, 1, 0, 1]) x0 = x[z == 0] y0 = y[z == 1] x1 = x[z == 0] y1 = y[z == 1] plt.scatter(x0, y0, c='b') plt.scatter(x1, y1, c='r') --% See the attached example, you can run it as a script or import it as a module and use the function multi_scatter in your code. Goyo multi_scatter.py Description: Binary data -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Comet
Hi David, El sáb, 06-02-2010 a las 10:21 -0800, David Arnold escribió: Hi Eric, Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code: t=linspace(0,2*pi,2000); x=-sin(t); y=cos(t); comet(x,y) You can just write the function: import matplotlib.pyplot as plt def comet(x, y, fmt='', step=1, **kwargs): l, = plt.plot(x, y, fmt, **kwargs) num_points = len(x) for i in xrange(1, num_points + 1, step): l.set_data(x[:i], y[:i]) plt.draw() l.set_data(x, y) plt.draw() I think this could be better done using animation features of matplotlib, but I never used them and I think they varies across toolkits. Search the docs for animation examples anyway. Goyo What then happens is the path is drawn live, as in my python code below. This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction. In this situation, the following is not helpful: t=linspace(0,2*pi,2000); x=-sin(t); y=cos(t); plot(x,y) Because the student just sees sees the finished path. The comet command, on the other hand, allows the student to see that path as it is traced out in real time. David. On Feb 6, 2010, at 9:09 AM, Eric Firing wrote: David Arnold wrote: All, I am still wondering why there is no comet command in matplotlib. I was successful with the following: import matplotlib.pyplot as plt import numpy as np len=200 t=np.linspace(0,2*np.pi,len) x=np.cos(t) y=np.sin(t) xd=[x[0]] yd=[y[0]] l,=plt.plot(xd,yd) plt.axis([-1,1,-1,1]) for i in np.arange(1,len): xd.append(x[i]) yd.append(y[i]) l.set_xdata(xd) l.set_ydata(yd) plt.draw() plt.show() But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. I don't understand--what's the point of the example? What is comet, and how does it simplify anything? Eric -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ginput then show causes segfault
El sáb, 21-02-2009 a las 16:26 -0800, Daniel Soto escribió: i'd like to plot some data, get user input, and then plot the original data and user input. when i try to show() the data i get a segfault after about ten seconds. any clue what i'm doing wrong? using mac os x 10.5 with enthought distribution. thanks, drs #!/usr/bin/env python import pylab x = pylab.arange(0,10,0.1) y = pylab.sin(x) # plot and get user input, then close fig pylab.plot(x,y) points = pylab.ginput(2) points = pylab.array(points) pylab.close() # replot with chosen points pylab.plot(x,y) pylab.plot(points[:,0],points[:,1],'ko') pylab.show() # wait for it, wait for it...now segfault Your code works for me in Ubuntu 8.10, mpl 0.98.5.2 (Debian package!) and GTKAgg backend. Goyo -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Issues with time display
Hi clolern2, - for some reason a TZ has been inserted Datetime values are stored as numbers. Timezone info is added when that numbers are converted again into datetimes for labelling. - graphs have white space buffers on either side of the X-axix You can use axes.xlim in order to adjust it. - points on X-axis are separated by the hour, instead of values in datetime object Matplotlib automagically chooses a format depending on the scale but you can specify a format: import matplotlib.dates as mdates ... xaxis.set_major_formatter(mdates.DateFormatter('%Y-%b-%d %H:%M')) Goyo El mié, 11-02-2009 a las 09:38 -0800, collern2 escribió: Hi, I've managed to take the contents of my CSV file and display it with matplotlib. I'm having some issues with the way my X-axis is being displayed. For the X-axis, I pass in a list that filled with datetime objects, an example of one element on the list: datetime.datetime(2007, 12, 17, 20, 28, 15), Issues (please see the attached cpu.png: - for some reason a TZ has been inserted - graphs have white space buffers on either side of the X-axix - points on X-axis are separated by the hour, instead of values in datetime object I have tried many variations of plotdate, etc. If someone could please point me in the right direction. Thanks = Code http://www.nabble.com/file/p21958283/cpu.png = #!/usr/bin/env python import csv import sys import matplotlib.pyplot as plt import datetime new_list = [] time = [] cpu = [] fileReader = csv.reader(open(sample.csv, rb)) for row in fileReader: new_list.append(row) # Converts papatimes time format into dattime def time_split(current_line): # splits papastats datetime format in useable python list dt = datetime.datetime.strptime(current_line[0],%Y/%m/%d %H:%M:%S) time.append(dt) def cpu_calc(current_line): cpu.append(current_line[11].rstrip(%)) #Iterate over list of CSV values for i in new_list[1:]: time_split(i) cpu_calc(i) plt.plot(time, cpu, 'b-') #plt.plot_date(time, cpu, fmt='b-', xdate=False, ydate=False, tz=None) plt.xlabel('Time') plt.ylabel('CPU %') plt.title('Daily CPU Usage') plt.grid(True) plt.grid(alpha=0.2, color='black', linestyle='-', linewidth=0.1) plt.show() -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I debug under PythonWin or IDLE?
El jue, 08-01-2009 a las 12:09 -0600, de...@verizon.net escribió: I am sure this is a well know issue, so please feel free to just give a link if the answer and solution are long. I have a newly installed matplotlib installations running on Windows XP using Python 2.5.4. When I execute a simple 4 line example (copied directly from the PyPlot tutorial) in either PythonWin or IDLE, , it works fine and I terminate by right clicking on the generated figure and doing a Close. However, when I rerun the code from the IDE (makes no difference if I use PythonWin or IDLE) the figure hangs and eventually I get an abnormal exit and crash out of the IDE (in PythonWin there is a dialogue box that says “Runtime Error” in pythonwin.exe. This makes debugging in an IDE very clumsy, because I need to exit and restart it every time I run python code. The test code is simply: import matplotlib.pyplot as plt plt.plot([1,2,3]) plt.ylabel('Some Numbers') plt.show() Thanks in advance, David Lees Interactive mode works for me in an IDLE shell: import matplotlib.pyplot as plt plt.ion() plt.plot([1,2,3]) plt.ylabel('Some Numbers') plt.show() # You don't have to call show() in interactive mode though Goyo -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I debug under PythonWin or IDLE?
El dom, 11-01-2009 a las 16:48 +0100, Goyo escribió: El jue, 08-01-2009 a las 12:09 -0600, de...@verizon.net escribió: I am sure this is a well know issue, so please feel free to just give a link if the answer and solution are long. I have a newly installed matplotlib installations running on Windows XP using Python 2.5.4. When I execute a simple 4 line example (copied directly from the PyPlot tutorial) in either PythonWin or IDLE, , it works fine and I terminate by right clicking on the generated figure and doing a Close. However, when I rerun the code from the IDE (makes no difference if I use PythonWin or IDLE) the figure hangs and eventually I get an abnormal exit and crash out of the IDE (in PythonWin there is a dialogue box that says “Runtime Error” in pythonwin.exe. This makes debugging in an IDE very clumsy, because I need to exit and restart it every time I run python code. The test code is simply: import matplotlib.pyplot as plt plt.plot([1,2,3]) plt.ylabel('Some Numbers') plt.show() Thanks in advance, David Lees Interactive mode works for me in an IDLE shell: import matplotlib.pyplot as plt plt.ion() plt.plot([1,2,3]) plt.ylabel('Some Numbers') plt.show() # You don't have to call show() in interactive mode though Goyo I'm using the TKAgg backend, I guess there will be problems with other interactive backends. Goyo -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can't create graphs
Make sure yu're using a backend with a user interface. http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend El mié, 19-11-2008 a las 10:49 -0500, Ron Brennan escribió: Hello, I am completely new to Matplotlib. I can't seem to get my script (a copy and paste from a Histogram example) to generate a graph. When I run my script, the command prompt returns. Is there something I am missing? # # histogram.py # import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt mu, sigma = 100, 15 x = mu + sigma*np.random.randn(1) # the histogram of the data n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75) # add a 'best fit' line y = mlab.normpdf( bins, mu, sigma) l = plt.plot(bins, y, 'r--', linewidth=1) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show() Calling with: python histogram.py - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Calling xlim makes x tick labels format get lost
El dom, 12-10-2008 a las 13:22 -1000, Eric Firing escribió: Goyo wrote: Hi all, I'm plotting time series and using a custom format for x tick labels because I want to see both date and time. But calling xlim makes the default format return -- only dates or only times, it depends on the displayed interval. I can get my preferred format back by calling set_major_formatter again, but this is inconvenient for interactive use. I wonder if there is a better way for changing x limits while keeping tick labels format unchanged. I'm using matplotlib 0.98.3 Thanks Goyo Sample code -- you need a combination of python shell and matplotlib GUI which allows for interactive use in order to get this working as expected: from matplotlib import pyplot from matplotlib import dates from datetime import datetime, timedelta from numpy import random pyplot.ion() # create data dstart = datetime(2008, 1, 1, 0, 0) dend = datetime(2008, 1, 5, 23, 50) delta = timedelta(minutes=10) x = dates.drange(dstart, dend, delta) y = random.random_sample(len(x)) # plot data pyplot.plot(x, y) # format x tick labels axis = pyplot.gca() fig = pyplot.gcf() axis.xaxis.set_major_formatter(dates.DateFormatter('%Y-%b-%d %H:%M')) fig.autofmt_xdate() # draw the figure pyplot.draw() -- Look at the tick labels, they show both date and time even if you zoom and pan using the GUI. Now if I want to look at the second day: dstart = datetime(2008, 1, 1, 0, 0) dend = datetime(2008, 1, 1, 23, 50) pyplot.xlim(dstart, dend) And the format has changed. I don't see this problem using ipython -pylab with mpl from svn on linux, gtkagg backend. What version, backend, and platform are you using? matplotlib 0.98.3-3ubuntu1~ppa1 from Benjamin Drung's ppa (http://ppa.launchpad.net/bdrung/ubuntu) on Ubuntu Hardy. It was the standard python shell and TKAgg, but I get the same result with ipython -pylab and GTKAgg. Indeed the format change can be documented: print axis.xaxis.get_major_formatter() pyplot.xlim(dstart, dend) print axis.xaxis.get_major_formatter() The first print: matplotlib.dates.DateFormatter instance at 0xb6e2462c and the second: matplotlib.dates.AutoDateFormatter instance at 0x884dc4c I did some debugging and realized that xaxis.units is None after plotting, so xlim triggers a call to xaxis.set_units which sets the default formatter (and units, whatever it means). If I set my formatter again, xaxis.units is not None anymore but still xaxis._update_axisinfo sets the default formatter. Anyway I worked around this by writing my own version of xlim which first saves the formatter, then sets xlim and sets the saved formatter again. Goyo - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Calling xlim makes x tick labels format get lost
Hi all, I'm plotting time series and using a custom format for x tick labels because I want to see both date and time. But calling xlim makes the default format return -- only dates or only times, it depends on the displayed interval. I can get my preferred format back by calling set_major_formatter again, but this is inconvenient for interactive use. I wonder if there is a better way for changing x limits while keeping tick labels format unchanged. I'm using matplotlib 0.98.3 Thanks Goyo Sample code -- you need a combination of python shell and matplotlib GUI which allows for interactive use in order to get this working as expected: from matplotlib import pyplot from matplotlib import dates from datetime import datetime, timedelta from numpy import random pyplot.ion() # create data dstart = datetime(2008, 1, 1, 0, 0) dend = datetime(2008, 1, 5, 23, 50) delta = timedelta(minutes=10) x = dates.drange(dstart, dend, delta) y = random.random_sample(len(x)) # plot data pyplot.plot(x, y) # format x tick labels axis = pyplot.gca() fig = pyplot.gcf() axis.xaxis.set_major_formatter(dates.DateFormatter('%Y-%b-%d %H:%M')) fig.autofmt_xdate() # draw the figure pyplot.draw() -- Look at the tick labels, they show both date and time even if you zoom and pan using the GUI. Now if I want to look at the second day: dstart = datetime(2008, 1, 1, 0, 0) dend = datetime(2008, 1, 1, 23, 50) pyplot.xlim(dstart, dend) And the format has changed. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] GTKAgg throwing an exception
I can't make much sense of this. You don't plot anything and don't use canvas. This code works: import matplotlib matplotlib.use('GTKAgg') from matplotlib import pyplot pyplot.plot([0, 1, 2, 3], [0, 1, 2, 3]) fig = pyplot.gcf() fig.savefig('test.jpg') But I don't know how to set the dpi value this way. I tried to use the OO API but no success. Goyo El dom, 12-10-2008 a las 23:45 +0200, Jesper Larsen escribió: Hi matplotlib-users, I decided to try to make some plots that I have previously made in png format using the Agg backend in jpeg format using the GTKAgg backend (which I guess is the one I should use for this). Unfortunately my script exits with an error. I have therefore created a simple test script (test.py) that illustrates the problem (at least on my computer): import matplotlib from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas fig = matplotlib.figure.Figure(dpi=100) canvas = FigureCanvas(fig) fig.savefig('test.jpg') When I run it I get: $ python test.py /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py:357: GtkWarning: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed gtk.DrawingArea.realize(self) /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py:360: GtkWarning: gdk_pixmap_new: assertion `(drawable != NULL) || (depth != -1)' failed pixmap = gdk.Pixmap (self.window, width, height) Traceback (most recent call last): File test.py, line 6, in module fig.savefig('test.jpg') File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 964, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1310, in print_figure **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py, line 347, in print_jpeg return self._print_image(filename, 'jpeg') File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py, line 360, in _print_image pixmap = gdk.Pixmap (self.window, width, height) RuntimeError: could not create GdkPixmap object I am using matplotlib 0.98.3, pygtk 2.14.0. My system is a Linux Ubuntu: $ uname -a Linux blanket out #1 SMP Wed Aug 20 18:39:13 UTC 2008 i686 GNU/Linux Does anyone know what is wrong? Best regards, Jesper - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] GTKAgg throwing an exception
El lun, 13-10-2008 a las 00:41 +0200, Goyo escribió: But I don't know how to set the dpi value this way. I tried to use the OO API but no success. Well yes... import matplotlib matplotlib.use('GTKAgg') from matplotlib import pyplot fig = pyplot.figure(dpi=100) ax = fig.add_subplot('111') ax.plot([1, 2, 3], [1, 2, 3]) fig.savefig('test.jpg') But changing the dpi value has no effect so maybe I'm missing something. Goyo - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting scattered data from array
El jue, 25-09-2008 a las 22:19 +0200, Oz Nahum escribió: ¿What's the meaning of that data arrange? I can't make any sense of plotting a 2D scatter from a 3D array. when I wrote: head = [[0,0,10], [1,0,13], [2,0,11], [3,0,12], [1,2,11]] my meaning was to represent point of intereset with x, y coordinates and the 3rd number was height for example. I felt like I couldn't access the individual points easily, because their are located in on big list... So I wanted to have the list broken into rows, and the each row represents a value on the y axis... like this: head = [ [[0,0,10], [0,0,13]], [[2,0,11], [3,0,12]], ] Mm... maybe this is better for your eyes but not for processing, I think. But that's redundant I think now, after looking into the function zip. Maybe I could write head in the following way: # j = 0 1 head = [ [[0,10], [1,13]], # i =0 [[0,11], [1,12]], # i =1 ] The same. Parsing a data file usually yields a sequence of rows (records), data processing functions usually expects columns of homogeneous data and convert from records to columns and back is pretty straightforward using zip. If you want to use a different representation for your data you'll need to handle more complex structures and conversions. Do it if you think it pays (sometimes it does). But actually after understanding what zip does, I think I don't need it anyway... Talking about this: can you give me an example of another use of zip ? not just zip(*head) I did help(zip) but I could partially understand what it does. I learned more by doing: x,y,z = zip(*head) and then printing x,y,z individually. There is no other use I can think of. If you think of the arguments passed to zip as rows, it returns the columns. If the arguments are columns, zip returns rows. How you name things depends on how you think of your data. There is no other use I can think of. zip expects each row (if they are rows) to be passed as an argument so you usually need that * thing to unpack them. When you call zip(*x), x being a sequence or array-like, you are actually passing each element of x as an argument to zip. Try this: numbers = [1, 2, 3, 4, 5] english = ['one', 'two', 'three', 'four', 'five'] spanish = ['uno', 'dos', 'tres', 'cuatro', 'cinco'] x = [numbers, english, spanish] zip(numbers, english, spanish) zip(x) zip(*x) You can learn about unpacking and zipping sequences reading the Python Tutorial or another similar resource (maybe Dive into Python dives into it, not sure but a useful reading anyway). Goyo - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting scattered data from array
Try something like this: import pylab as pl head = ((0,0,10), (1,0,13), (2,0,11), (3,0,12), (1,2,11)) x, y, z = zip(*head) xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1) g = pl.griddata(x, y, z, xi, yi) pl.scatter(x, y) pl.contour(xi, yi, g) Level values are automatically chosen in this example but you can provide the number of values or a sequence of them. Note that no extrapolation is done outside convex hull defined by input data. Goyo El sáb, 20-09-2008 a las 11:13 +0200, Oz Nahum escribió: I'm trying again to understand how to plot scattered data from array into contour graph. I looked at http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data and I understand I have to grid my data. However, in most samples the plot is of a function. Let's say I want to plot some geological data, suppose water table head, and I have the following 3D aray x yhead head = ((0,0,10), (1,0,13), (2,0,11), (3,0,12), (1,2,11)) matplotlib has lot's of restrictions about how I can plot and interpolate the data, which causes a lot of confusion in my side... I'll be happy if someone could supply me a clue of how to plot contours of data which comes in arrays or raster format and not an equation. Thanks, Oz - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Lines drawn across NaN data
Tanks, Michael. Maybe I'll try to build from SVN this weekend. Goyo El jue, 18-09-2008 a las 09:31 -0400, Michael Droettboom escribió: Proper NaN handling has been a long and winding road. This particuar bug you're running into was fixed about a week *after* the 0.98.3 release. Here's the patch: http://matplotlib.svn.sourceforge.net/viewvc/matplotlib?view=revrevision=6018 So SVN trunk currently works. The patch against 0.98.3 is non-trivial -- there were actually many changes throughout the code to make all this work, so there isn't an easy workaround, and in any case requires a recompile. If you can build from SVN, that's what I would suggest -- otherwise wait for the 0.98.4 release (I don't believe we have an ETA on that, yet). Cheers, Mike Goyo wrote: I'm having trouble plotting data with NaN values. My plot has lines and markers and usually both are skipped for NaN values. But when I have more than 127 data a line is drawn from the last non-NaN to the next. I read somewhere about a similar issue (maybe here? sorry I can't find it just now), it seems like it has to do with some optimization performed for large datasets and the use if lineto instead of moveto or something like that. It was supposed to be fixed in 0.98.2 but I'm using 0.98.3 from Benjamin Drung's PPA (http://ppa.launchpad.net/bdrung). This code shows the difference between plotting 127 and 128 data (look at the left of each figure): import pylab as pl x = pl.random(128) x[4:7] = pl.NaN y = x[:-1] pl.figure(1) pl.plot(x, '-o') pl.grid(True) pl.figure(2) pl.plot(y, '-o') pl.grid(True) pl.show() Is this a known issue? Is there any workaround? Thanks Goyo - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Lines drawn across NaN data
I'm having trouble plotting data with NaN values. My plot has lines and markers and usually both are skipped for NaN values. But when I have more than 127 data a line is drawn from the last non-NaN to the next. I read somewhere about a similar issue (maybe here? sorry I can't find it just now), it seems like it has to do with some optimization performed for large datasets and the use if lineto instead of moveto or something like that. It was supposed to be fixed in 0.98.2 but I'm using 0.98.3 from Benjamin Drung's PPA (http://ppa.launchpad.net/bdrung). This code shows the difference between plotting 127 and 128 data (look at the left of each figure): import pylab as pl x = pl.random(128) x[4:7] = pl.NaN y = x[:-1] pl.figure(1) pl.plot(x, '-o') pl.grid(True) pl.figure(2) pl.plot(y, '-o') pl.grid(True) pl.show() Is this a known issue? Is there any workaround? Thanks Goyo - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users