Re: [Matplotlib-users] Include \hline on table inside figure
On Fri, Jan 23, 2015 at 1:42 PM, Thomas Caswell tcasw...@gmail.com wrote: Have you looked at using the mpl tables? http://matplotlib.org/examples/pylab_examples/table_demo.html Just pointing out: the numbers in those tables and the words other than Quake are slightly cut-off at the top in the demo. -- New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] odd singular matrix error
Still though, I thought we had enough logic checks to prevent this sort of error. I see you are using Python 2.5, which is older than what we currently support. Which version of matplotlib are you using? I'm using matplotlib 1.1.0. I could try upgrading. Ben and others, OK, I tried upgrading to Python 2.6 and Matplotlib 1.4.2. The problem with the singular matrix goes away! But... ...But now I have no patch shown on the plot. This is the function I am using now to add a patch (editing to just keep the MPL relevant stuff)...maybe this is no longer a good way?: def AddPatch(self,): ax = self.subplot verts = [ (start, y-scaling_value), # left, bottom (start, y+scaling_value), # left, top (stop, y+scaling_value), # right, top (stop, y-scaling_value), # right, bottom (0., 0.), # ignored ] codes = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY, ] x = [start, stop] # x range of box (in data coordinates) height = 12 # of box in device coords (pixels) path = mpath.Path([[x[0], -height], [x[1], -height], [x[1], height], [x[0], height], [x[0], -height]]) #USING THE NEW TRANSFORMS fixed_pt_trans = FixedPointOffsetTransform(ax.transData, (0, y)) xdata_yfixed = mtrans.blended_transform_factory(ax.transData, fixed_pt_trans) patch = patches.PathPatch(path, transform=xdata_yfixed, facecolor=color,alpha=0.4, lw=1, edgecolor='grey') ax.add_patch(patch) -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] odd singular matrix error
On Wed, Dec 31, 2014 at 9:45 AM, Benjamin Root ben.r...@ou.edu wrote: What might be happening is that the patch being added has no area. The logic it is failing in is in the autoscaling section, I believe. This is why if there are other things already in the plot or with other patches, then the code works fine because the limits aren't identical. If it is helpful, when I print the value of the patch, I get this: patch is: Poly((735597, -12) ...) What's weird though, is that the other plot I'm talking about is a *different* plot entirely (different canvas instance), and can be closed first and still allow the patch plot to be shown without errors. Still though, I thought we had enough logic checks to prevent this sort of error. I see you are using Python 2.5, which is older than what we currently support. Which version of matplotlib are you using? I'm using matplotlib 1.1.0. I could try upgrading. Cheers! Ben Root On Wed, Dec 31, 2014 at 2:03 AM, C M cmpyt...@gmail.com wrote: I have no idea what this is. If I create a certain plot first in an application, it throws this error (edited to the key part): Traceback (most recent call last): File thescript.py, line 2147, in AddPatchBar ax.add_patch(patch) File C:\Python25\lib\site-packages\matplotlib\axes.py, line 1471, in add_patch self._update_patch_limits(p) File C:\Python25\lib\site-packages\matplotlib\axes.py, line 1492, in _update_patch_limits self.transData.inverted()) File C:\Python25\lib\site-packages\matplotlib\transforms.py, line 1954, in inverted return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) File C:\Python25\lib\site-packages\matplotlib\transforms.py, line 1448, in inverted self._inverted = Affine2D(inv(mtx)) File C:\Python25\lib\site-packages\numpy\linalg\linalg.py, line 445, in inv return wrap(solve(a, identity(a.shape[0], dtype=a.dtype))) File C:\Python25\lib\site-packages\numpy\linalg\linalg.py, line 328, in solve raise LinAlgError, 'Singular matrix' numpy.linalg.linalg.LinAlgError: Singular matrix But, the odd part is that if I create a completely different and totally separate plot *before* this one, and *then* I try to plot this one, I do not get this error and this plot shows fine. That makes no sense to me. Or also, if I plot this patch on a plot with a few other lines plotted, it also works. Does anyone have any idea what could be causing this? Thanks. -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] odd singular matrix error
I have no idea what this is. If I create a certain plot first in an application, it throws this error (edited to the key part): Traceback (most recent call last): File thescript.py, line 2147, in AddPatchBar ax.add_patch(patch) File C:\Python25\lib\site-packages\matplotlib\axes.py, line 1471, in add_patch self._update_patch_limits(p) File C:\Python25\lib\site-packages\matplotlib\axes.py, line 1492, in _update_patch_limits self.transData.inverted()) File C:\Python25\lib\site-packages\matplotlib\transforms.py, line 1954, in inverted return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) File C:\Python25\lib\site-packages\matplotlib\transforms.py, line 1448, in inverted self._inverted = Affine2D(inv(mtx)) File C:\Python25\lib\site-packages\numpy\linalg\linalg.py, line 445, in inv return wrap(solve(a, identity(a.shape[0], dtype=a.dtype))) File C:\Python25\lib\site-packages\numpy\linalg\linalg.py, line 328, in solve raise LinAlgError, 'Singular matrix' numpy.linalg.linalg.LinAlgError: Singular matrix But, the odd part is that if I create a completely different and totally separate plot *before* this one, and *then* I try to plot this one, I do not get this error and this plot shows fine. That makes no sense to me. Or also, if I plot this patch on a plot with a few other lines plotted, it also works. Does anyone have any idea what could be causing this? Thanks. -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pick markers only but not the connecting line
Great, thanks for all the help! On Sun, Jun 8, 2014 at 12:09 AM, Eric Firing efir...@hawaii.edu wrote: On 2014/06/07, 5:03 PM, C M wrote: On Sat, Jun 7, 2014 at 10:18 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: On 2014/06/07, 4:12 PM, C M wrote: I had been using a custom function (written originally by Jae-Joon and modified a little by me...quite a long time back now) that was working to allow point picking of markers, but *not* the line connecting them. However, I've now discovered with the help of this list that the function I am using has the disadvantage that if there are more than 100 data points, I can't get the correct index for the picked marker (turned out not to be a mpl bug: https://github.com/matplotlib/matplotlib/issues/3124). So I can just use the default pick event, but then the user can pick anywhere on the connecting line, which is meaningless in this use--so I don't want them to be able to pick on the connecting line. Why not just execute plot twice, once with the markers, with picking activated, and a second time with the line, with picking inactive (the default). Eric That is so simple, and I hadn't thought of it at all. Thank you! My only concerns would be for slowness of plotting if there are a lot of points and just code simplicity, and so if there could be some other way with a custom function for the picker that would do this, I would probably prefer that. But maybe neither of these are particularly important concerns. I think you will find plotting two lines instead of one is not at all prohibitive with respect to speed; especially when you are zooming, so that the number of points being plotted is not so large. As for simplicity, two calls to a standard function with almost the same arguments beats an arcane special-purpose function! If you want to make your own picker, though, it looks like you could use a slight modification of Line2D.contains(); it would be just a matter of copying it and replacing this section # Check for collision if self._linestyle in ['None', None]: # If no line, return the nearby point(s) d = (xt - mouseevent.x) ** 2 + (yt - mouseevent.y) ** 2 ind, = np.nonzero(np.less_equal(d, pixels ** 2)) else: # If line, return the nearby segment(s) ind = segment_hits(mouseevent.x, mouseevent.y, xt, yt, pixels) with the code in the first option--that is, without checking the _linestyle. You would also need to remove the first two lines after the docstring. Eric Che -- 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/NeoTech ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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/NeoTech ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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/NeoTech___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] event.ind in point picking gives wrong number
Hello again. This is follow-up on this 9 month old thread (I left this issue for a while and am now returning to it). I upgraded to the latest stable version of Matplotlib, 1.3.1, and tested and I am still getting the exact same confusing problem. Now I also have a small runnable test script that demonstrates this problem, from IDLE using Python 2.7 and Matplotlib 1.3.1. Attached is the script. If you run it as is, it will show a plot. Click on the last point (which is obviously higher than the rest) and note the index number that is printed in the IDLE prompt. It should say index is: [154]. But now zoom the plot tightly around that last point, and click on it again. Now it will report that the index is much smaller (depending on how tightly you zoomed), down to index is: [1]. This is the problem. What's critical to point out is: this only occurs with *this* data. To show that, go to the script and comment out the line near the end that starts with plt.plot(bad_final_dates, and comment in the one below it, that starts with plt.plot(good_final_dates,. Run the script again, and repeat the process above. You'll find that zooming does not affect the index number--which is the correct behavior. The contains_points() function was something I got on this mailing list from Jae-Joon some years back, and it is above my level of understanding, and it's possible I goofed something up in there. I'm really puzzled why one set of data doesn't have this problem and another one does. Any suggestions for what's wrong greatly appreciated. Thanks, Che On Mon, Sep 16, 2013 at 9:15 AM, Benjamin Root ben.r...@ou.edu wrote: On Sun, Sep 15, 2013 at 11:59 PM, C M cmpyt...@gmail.com wrote: Just a follow-up on this problem... I've found now that the index is only off if the plot is zoomed, and in the following way. When I zoom, the first point that is visible in the plot window will have index = 0, the next point will have index = 1, and so forth. If I zoom another section of the points, the indices are reset in this same way. What's really bizarre is that this is only occurring on one plot. When I try to reproduce the problem on other plots (so far at least), I can't. Any suggestions for how to chase this down would be very welcome. Thanks. That is a very useful observation. I am not very familiar with the artist picking code, but if I have to guess, I would wonder if indices are being determined from a path created *after* clip_to_rect() is used internally. Given that you are having difficulties in reproducing this issue in other plots, I would suggest trying to pare down your badly behaving code as much as you can and post it here. Furthermore, it would also be useful to determine if the issue still occurs in v1.3 or in the master branch. Cheers! Ben Root import matplotlib.pyplot as plt import numpy as np def contains_points(line, mouseevent): line.pickradius = 5 # Make sure we have data to plot if line._invalidy or line._invalidx: line.recache() if len(line._xy)==0: return False,{} # Convert points to pixels if line._transformed_path is None: line._transform_path() path, affine = line._transformed_path.get_transformed_points_and_affine() path = affine.transform_path(path) xy = path.vertices xt = xy[:, 0] yt = xy[:, 1] pixels = line.figure.dpi/72. * line.pickradius d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2 ind, = np.nonzero(np.less_equal(d, pixels**2)) print 'index is: ', str(ind) return len(ind)0,dict(ind=ind) bad_final_dates = [735079.1214674653, 735079.5, 735079.55647688662, 735079.60561398149, 735079.60901608795, 735079.61007837963, 735079.61141004635, 735079.61222394672, 735079.61267262732, 735079.61740547454, 735079.61793575226, 735079.61845732643, 735079.61902608792, 735079.68499270838, 735079.68542109954, 735079.68880315975, 735079.68926655094, 735079.68966354162, 735079.69596565969, 735079.701868125, 735079.70749983797, 735079.70960563654, 735079.71045478014, 735079.71102318284, 735079.71184613428, 735079.71230732638, 735079.71268356487, 735079.71303708339, 735079.71386268514, 735079.71445497684, 735079.715345, 735079.71684614581, 735079.7183792477, 735079.71955292823, 735079.72024780093, 735079.72192891198, 735079.72248410876, 735079.72560098383, 735079.72600572917, 735079.72638543986, 735079.72990056709, 735079.7316829, 735079.73226472223, 735079.73661531252, 735079.74144714116, 735079.74522572919, 735079.7468240856, 735079.74791210645, 735079.97846979171, 735079.98271479167, 735079.98447646992, 735080.12350728014, 735080.14091008098, 735080.55523804401, 735080.56125733792, 735080.63896374998, 735080.64021659724, 735080.64103072917, 735080.66268849536, 735080.7048011343, 735080.79961501155, 735080.86546409724, 735080.99817599542, 735081.0204026273, 735081.02133151621, 735081.02613285882, 735081.0271783449, 735081.0335956713, 735081.04115539347
Re: [Matplotlib-users] event.ind in point picking gives wrong number
On Sat, Jun 7, 2014 at 4:02 PM, Benjamin Root ben.r...@ou.edu wrote: Thanks for the example script. I think I have a clue now what is happening. Thank you for the quick reply. If one were to also print out the length of the d array, you will find that it is significantly shorter than when you aren't zoomed (I am getting a length of 7 when it should be 155). But it isn't truncated for the other dataset (which is of length 62). This makes me suspect that there is some threshold being triggered here (possibly around 128?). I've tested it, and it seems that threshold number is 100. If the dataset has 100 points, the zooming doesn't affect the index. If it has 101 or more (I guess...I didn't test it in any comprehensive way), I get the error. I think at this point, you should definitely file a bug report. I have filed a bug report: https://github.com/matplotlib/matplotlib/issues/3124 And I made it such that there is just the one data set and you can truncate it to however many points you want, with the direction being to try 101 (which it is set to initially) and then try 100 or less. Che -- 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/NeoTech___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pick markers only but not the connecting line
I had been using a custom function (written originally by Jae-Joon and modified a little by me...quite a long time back now) that was working to allow point picking of markers, but *not* the line connecting them. However, I've now discovered with the help of this list that the function I am using has the disadvantage that if there are more than 100 data points, I can't get the correct index for the picked marker (turned out not to be a mpl bug: https://github.com/matplotlib/matplotlib/issues/3124). So I can just use the default pick event, but then the user can pick anywhere on the connecting line, which is meaningless in this use--so I don't want them to be able to pick on the connecting line. My goal is to have a custom function that will serve *both* purposes: allow picking the markers only, not the line, of a set of data of any length while returning the correct index of that marker/data point. But the code in the custom function is mostly above my head, was written for mpl 0.99 or so, and I don't know how to modify it to get both purposes achieved. I attach the current sample again, with the problematic custom picker function, contains_points(). Thanks for any suggestions or help. Che import matplotlib.pyplot as plt import numpy as np def contains_points(line, mouseevent): line.pickradius = 5 # Make sure we have data to plot if line._invalidy or line._invalidx: line.recache() if len(line._xy)==0: return False,{} # Convert points to pixels if line._transformed_path is None: line._transform_path() path, affine = line._transformed_path.get_transformed_points_and_affine() path = affine.transform_path(path) xy = path.vertices xt = xy[:, 0] yt = xy[:, 1] pixels = line.figure.dpi/72. * line.pickradius d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2 ind, = np.nonzero(np.less_equal(d, pixels**2)) print 'index is: ', str(ind) return len(ind)0,dict(ind=ind) dates = [735079.1214674653, 735079.5, 735079.55647688662, 735079.60561398149, 735079.60901608795, 735079.61007837963, 735079.61141004635, 735079.61222394672, 735079.61267262732, 735079.61740547454, 735079.61793575226, 735079.61845732643, 735079.61902608792, 735079.68499270838, 735079.68542109954, 735079.68880315975, 735079.68926655094, 735079.68966354162, 735079.69596565969, 735079.701868125, 735079.70749983797, 735079.70960563654, 735079.71045478014, 735079.71102318284, 735079.71184613428, 735079.71230732638, 735079.71268356487, 735079.71303708339, 735079.71386268514, 735079.71445497684, 735079.715345, 735079.71684614581, 735079.7183792477, 735079.71955292823, 735079.72024780093, 735079.72192891198, 735079.72248410876, 735079.72560098383, 735079.72600572917, 735079.72638543986, 735079.72990056709, 735079.7316829, 735079.73226472223, 735079.73661531252, 735079.74144714116, 735079.74522572919, 735079.7468240856, 735079.74791210645, 735079.97846979171, 735079.98271479167, 735079.98447646992, 735080.12350728014, 735080.14091008098, 735080.55523804401, 735080.56125733792, 735080.63896374998, 735080.64021659724, 735080.64103072917, 735080.66268849536, 735080.7048011343, 735080.79961501155, 735080.86546409724, 735080.99817599542, 735081.0204026273, 735081.02133151621, 735081.02613285882, 735081.0271783449, 735081.0335956713, 735081.04115539347, 735081.04800446762, 735081.05008083337, 735081.05534546298, 735081.05918304401, 735081.06037712959, 735081.06172269676, 735081.06712594908, 735081.08196986106, 735081.62065618054, 735081.8688092361, 735081.86910491902, 735081.86998233793, 735081.99360535876, 735081.99586380785, 735082.00806468748, 735082.0098228819, 735082.01533834497, 735082.01674383099, 735082.02936186339, 735082.02976707171, 735082.03022675926, 735082.03069490741, 735082.03097482643, 735082.03125312505, 735082.03604334488, 735082.03765619209, 735082.05257208331, 735082.100969919, 735082.1024177199, 735082.10387097218, 735082.1388320023, 735082.337, 735082.53595807869, 735082.55833702546, 735082.56112760422, 735083.00588994217, 735083.007571875, 735113.50807679398, 735113.58693798608, 735114.03848809027, 735114.04119372682, 735115.5, 735119.8093059028, 735120.03856688656, 735253.07588778937, 735256.95615627314, 735258.69064364582, 735258.69268998841, 735258.69969299773, 735258.72694862273, 735259.62416826386, 735259.6248413, 735259.7361906945, 735259.75713817135, 735259.99948642356, 735260.00099298614, 735260.00174059032, 735260.00592855329, 735260.00680168986, 735260.00748263893, 735260.00827880786, 735260.00860694447, 735260.00958392362, 735260.02752453706, 735260.06593625003, 735260.07891475689, 735260.07907957176, 735260.07935114589, 735260.62010422454, 735260.62646800932, 735260.62662517361, 735260.66605687502, 735260.67675605323, 735260.68322124996, 735260.68342049769, 735260.68355356483, 735260.68561972224, 735260.68846386578, 735269.73599923612, 735285.60832390049, 735302.07172445604, 735304.07737268519, 735304.3925347,
Re: [Matplotlib-users] colorbllind problem
On Mon, Feb 17, 2014 at 1:15 PM, Gabriele Brambilla gb.gabrielebrambi...@gmail.com wrote: Hi, I'm dealing with a guy that is colorblind. Have you got any suggestion on how could I show a plot like the one attached to him? Is there an option in pyplot that write little numbers near the curves instead of colors? In addition to the other suggestions: If this is a plot that is viewed on his computer, you could also build in line picking, so that if the user mouses over the line, information about that line is shown in the toolbar or however you want. -- 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=121054471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] event.ind in point picking gives wrong number
I have Matplotlib 1.1.0, and am doing point picking (using the OO approach to Matplotlib, and embedded in wxPython). My relevant code is as follows: #connect the pick event to the pick event handler: self.cid = self.canvas.mpl_connect('pick_event', self.on_pick) #This is the relevant part of the pick event handler: def on_pick(self, event): if isinstance(event.artist, Line2D): ind = event.ind print 'ind is: ', str(ind) This had been working in some cases, but I've found a case in which it appears to be giving me a value for ind that doesn't make sense. For example, I have a plot with two lines on it (and two y axes), each with over 50 points. When I pick one of the points right near the end, I expect the ind here will be about 50. However, it prints ind is: 3. In other words, the wrong index value. This is a serious issue for me, because I then use that index to look up information about that point. What could be going on here? Thanks, Che -- 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/22/13. http://pubads.g.doubleclick.net/gampad/clk?id=64545871iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] event.ind in point picking gives wrong number
Just a follow-up on this problem... I've found now that the index is only off if the plot is zoomed, and in the following way. When I zoom, the first point that is visible in the plot window will have index = 0, the next point will have index = 1, and so forth. If I zoom another section of the points, the indices are reset in this same way. What's really bizarre is that this is only occurring on one plot. When I try to reproduce the problem on other plots (so far at least), I can't. Any suggestions for how to chase this down would be very welcome. Thanks. On Sun, Sep 15, 2013 at 5:30 PM, C M cmpyt...@gmail.com wrote: I have Matplotlib 1.1.0, and am doing point picking (using the OO approach to Matplotlib, and embedded in wxPython). My relevant code is as follows: #connect the pick event to the pick event handler: self.cid = self.canvas.mpl_connect('pick_event', self.on_pick) #This is the relevant part of the pick event handler: def on_pick(self, event): if isinstance(event.artist, Line2D): ind = event.ind print 'ind is: ', str(ind) This had been working in some cases, but I've found a case in which it appears to be giving me a value for ind that doesn't make sense. For example, I have a plot with two lines on it (and two y axes), each with over 50 points. When I pick one of the points right near the end, I expect the ind here will be about 50. However, it prints ind is: 3. In other words, the wrong index value. This is a serious issue for me, because I then use that index to look up information about that point. What could be going on here? Thanks, Che -- 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] time axis format
On Mon, Jun 10, 2013 at 8:08 PM, Sudheer Joseph sudheer.jos...@yahoo.comwrote: Thank you, So there is no way to get J F M A etc with out reducing font size? I bet there a number of ways. Offhand I don't know the one that, once I hear about it, I will say, D'oh, that's so easy but I bet it exists. But you could modify the DateFormatter class. It is set to return a strftime result string. Here is the function: def __call__(self, x, pos=0): if x==0: raise ValueError('DateFormatter found a value of x=0, which is an illegal date. This usually occurs because you have not informed the axis that it is plotting dates, eg with ax.xaxis_date()') dt = num2date(x, self.tz) return self.strftime(dt, self.fmt) All you would have to do is change that last line to: return self.strftime(dt, self.fmt)[0] To slice just the first letter of the month. So you could subclass DateFormatter to do this, since you probably don't want to modify the actual DateFormatter class always in this way. Also, aside from the J F M A approach, you could just rotate the month's name, and that will reduce crowding while keeping the month a little clearer (I think JAN FEB MAR APR is more intuitive and pleasant to read on a graph). Che We often need to make presentation in front of senior people who insist for bigger fonts. With best regards, Sudheer -- * From: * Paul Hobson pmhob...@gmail.com; * To: * Sudheer Joseph sudheer.jos...@yahoo.com; * Cc: * matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net; * Subject: * Re: [Matplotlib-users] time axis format * Sent: * Mon, Jun 10, 2013 8:08:18 PM In that case, I would use ax.tick_params(...) to make the font smaller. On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph sudheer.jos...@yahoo.comwrote: Dear Paul, The issue I am facing is like in the attached plot where the month naming get cluttered. with best regards, Sudheer *** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com Web- http://oppamthadathil.tripod.com *** -- *From:* Sudheer Joseph sudheer.jos...@yahoo.com *To:* Paul Hobson pmhob...@gmail.com *Cc:* matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net *Sent:* Saturday, 8 June 2013 7:46 PM *Subject:* Re: [Matplotlib-users] time axis format Thank you Paul for the helping hand, However I was looking for slightly different solution like in the attached plots. I used ferret to do this based on the length of the time axis it chose the mode of labelling. for example in case of 2 year plot it made month labeling as j f m etc and in case of 1 year as there is enough space on x axis it made jan feb etc with single label of year. In the attached python plot (ATser_RAMA_HYCOM_U_8n90e.png) every tick point is lablled for year, which I wanted to avoid and get plots similar to the first types thought it is not done automatically but at least manually. *** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com Web- http://oppamthadathil.tripod.com *** -- *From:* Paul Hobson pmhob...@gmail.com *To:* Sudheer Joseph sudheer.jos...@yahoo.com *Cc:* matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net *Sent:* Friday, 7 June 2013 8:50 PM *Subject:* Re: [Matplotlib-users] time axis format On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph sudheer.jos...@yahoo.com wrote: Dear Experts, I have been experimenting with the plot_dates option of matplotlib to plot time series data and have below questions I have used loc = mdates.AutoDateLocator() ax.xaxis.set_major_locator(loc) ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n %Y')) and got the tick labels in attached plot However I feel the repeatd year labeling is not needed here and it is required once in a year only , Also if I need to plot long time seris insted of MAR APR I wanted to get them reduced to M A etc so that the lavel
Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1
On Thu, Apr 18, 2013 at 11:03 PM, John Ladasky john_lada...@sbcglobal.netwrote: . Reading more, I realize that the way I was getting GUI output previously (with Python 2.7 and Matplotlib 1.1) was through wxPython. Unfortunately, it appears that wxPython's star is fading, and a Python 3-compatible version will not be written. In fact, wxPython hasn't released a new version in nine months. wxPython is alive and well and the newest developmental version of it (Phoenix) runs on Python 3. It should be released fairly soon. One of the wxPython list regulars mentioned getting his software to run with it, with a few minor issues, just six days ago. So you might want to give Phoenix a try. Che -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib is slow
Resurrecting an old thread here On Tue, Mar 29, 2011 at 3:23 PM, David Kremer da...@david-kremer.fr wrote: I would recommend running the import in the Python profiler to determine where most of the time is going. When I investigated this a few years back, it was mainly due to loading the GUI toolkits, which are understandably quite large. You can avoid most of that by using the Agg backend. If you're using the Agg backend and still experiencing slowness, it may be that load-up issues have crept back into matplotlib since then -- but we need profiling data to figure out where and how. Importing Matplotlib is very slow for me, too. For a wxPython application with embedded Matplotlib, I am getting load times of 20 seconds when cold importing matplotlib, with this (circa mid 2004) computer setup: Windows XP, sp3, Intel Pentium, 1.70 Ghz, 1 GB RAM. This is, by the way, an import well after Python and wxPython have already been loaded into RAM, as it happens by a user action, so none of the time involved here is due to loading Python or wxPython (they both load more quickly--about 10 seconds to cold import them, my code, images, and some other libraries). First of all: does that amount of time seem appropriate for that fast of a system--or is that too long? It definitely *feels* way too long from a user perspective (for comparison Word or PowerPoint loads on this computer in about 2.5 seconds). Trying to improve it and following this old thread, I have switched to matplotlib.use('Agg') instead of matplotlib.use('wxAgg') as suggested to speed things up...but it is no faster. I see, though, that I also have lines such as: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg Would the presence of these imports obviate the fact that I switched to using the Agg instead of the wxAgg? If so, is there any way to use something faster here (I suspect not but thought I'd ask). Also, what else should I consider doing to reduce the import time significantly? (I have to learn how to use the profiler, so I haven't done that yet). Thanks, Che Mike Thank you a lot for your answer. I noticed than _matplotlib.pyplot_ is longer to be imported the first time than if it has already been imported previously (maybe things are already loaded in ram memory), and we don't need to fetch it from the hard drive thanks to the kernel. As far I see, the function calls are the same for the two logs I obtained, except than the first took 6s instead of 1.4s. The two logs have been obtained using : code python -m cProfile temp.py /code where temp.py consist of two lines : code #!/usr/bin/env python2 import matplotlib.pyplot /code -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] wrapping y axis tick labels?
How possible would it be to wrap y axis tick labels after a certain text length? I have a horizontal bar plot where some bars' labels are too long and therefore cut off. I can scrunch the width of the whole plot to accommodate them, but I'd much rather wrap long text and allow a little more space to accommodate two lines. For examples: I'd like to go from this: a short axis label | == A very long axis label that gets cut off | = To this: a short axis label | == A very long axis label | = that gets cut off Is this possible or has it ever been done? Thanks, Che -- 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 for Mac OS 10.7 (Lion)
Trying to help a Mac friend running OSX 10.7 (Lion) easily set up to test scripts I send him, and have some questions: 1) Can Matplotlib 1.1 run on the Python 2.7.2 version that comes with Lion? Yes. You can easily build it yoursef as long as you have XCode installed: - Edit setupext.py so that the list of values for darwin is ['/usr/local', '/usr', /usr/X11'] (and for a really vanilla build leave out /usr/local). (I have a pull request for this to be part of the standard distro, but I don't know if or when it will go in since not a big issue.) Then do the usual: % python setup.py build % sudo python setup.py install Where are you getting matplotlib 1.1 for Mac OSX 10.7 from to build it? 2) When is there expected to be an installer for Matplotlib 1.1 for OSX 10.7? There is one, but like all the matplotlib (and numpy and scipy) official binaries it uses python.org's python, not Apple's. To go this route install python.org's Python 2.7.2 for 10.6-and-later (which is 64-bit) and then install the official numpy and matpotlib binaries. From where? I didn't see it. I am talking about having a binary installer on the Matplotlib downloads page,,. the last one I see there is this, which is for OSX-10.6: matplotlib-1.1.0-py2.7-python.org-macosx10.6.dmg2012-02-15 which is from about two month ago. Thanks, Che -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib for Mac OS 10.7 (Lion)
Trying to help a Mac friend running OSX 10.7 (Lion) easily set up to test scripts I send him, and have some questions: 1) Can Matplotlib 1.1 run on the Python 2.7.2 version that comes with Lion? 2) When is there expected to be an installer for Matplotlib 1.1 for OSX 10.7? Thanks, Che -- 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
[Matplotlib-users] why does transform=None cause a patch not to be shown?
For the following code, if I remove the transform=None a green patch is shown. If it is in, it is not shown. I would think that transform=None should have no effect. Why is this? Thanks, Che import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.path import Path fig = plt.figure() ax = fig.add_subplot(111) start = 0.2 stop = .6 verts = [ (start, .2), # left, bottom (start, .4), # left, top (stop, .4), # right, top (stop, .2), # right, bottom (0., 0.), # ignored ] codes = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY, ] path = Path(verts, codes) patch = patches.PathPatch(path, facecolor='g', lw=1, edgecolor='grey',transform=None ) ax.add_patch(patch) plt.show() -- 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
[Matplotlib-users] make a rectangle that doesn't change with zoom.
I'm trying to make a rectangle that highlights a straight line of markers such that: 1) it surrounds/contains the points, basically like: -- | | | OO O O | | | |- 2) its height doesn't change with zoom. (it should always be approximately a little taller than the height of the markers' heights). I can do (1) but so far not (2). I'm pretty sure I need to use a blended transform for this somehowand possibly TransformedPath, but I'm lost as to how to do this. Thanks, Che -- 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] custom markers from images?
I've for now taken a different approach that means I won't need custom markers from images. But I'm just curious: is there any wish/plans in Matplotlib to add support for this? I think it could do a lot to expand what's possible in terms of the look and feel of plots (even without things drifing into USA Today territory!). Just my $0.02 Che -- 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] custom markers from images?
Right. It should be technically feasible to just simply tell figimage to use a different transformation object, but this might have implications elsewhere. I am very hazy in this part of mpl. Hmm, I've simplified the figimage to just this line: fig.figimage(im,100,100,origin=upper, transform=None) And it puts the image 100 up and 100 px out from the lower right corner. I then tried setting the transform from None to all the various possible transforms listed on this page: http://matplotlib.sourceforge.net/users/transforms_tutorial.html as well as their inverted() forms. None of them allowed the image to be updated with data coordinates when the plot was resized. It really seems that figimage is a property of the figure only and not the canvas, so whatever the axes do is irrelevant to its placement. But I really don't know for sure. So far, this isn't going to work this way. Thanks, Che -- 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] custom markers from images?
Yeah, there are better ways to do that, somewhat. The problem with the proposed solution is that it relies on non-public APIs, which are can be subject to change without deprecation. Instead, I would have created the figimage object with a particular transform object that would have placed it at the appropriate data points. Maybe your or someone from this list can help me understand more about this. So, if I take the code that I have adapted to my purposes, there are questions I have about it: # constants dpi = 72; imageSize = (32,32) # read in our png file im = image.imread('redX_10.png') So far, so good--just setting the dpi and getting the image. fig = self.figure ax = self.subplot ax.get_frame().set_alpha(0) Does the current version of Matplotlib require the frame be set to fully transparent? I need a white canvas, so I think I'd rather not do that. # translate point positions to pixel positions # figimage needs pixels not points line = self.line_collections_list[0][0] line here is my line of datapoints from elsewhere in my app. line._transform_path() path, affine = line._transformed_path.get_transformed_points_and_affine() path = affine.transform_path(path) I have no understanding of the purpose of the previous three lines. Can someone give me a quick explanation? for pixelPoint in path.vertices: # place image at point, centering it fig.figimage(im,pixelPoint[0]+80,pixelPoint[1]+180,origin=upper) This is just a way to put the image somewhere on my canvas to see it, so these offsets are just for this exercise. I should state that if I do it this way, the images appear on the canvas but are NOT repositioned in data coordinates (and they should be)--which is probably just Ben's point, right? Thanks, Che -- 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
[Matplotlib-users] custom markers from images?
I'd like to use, in one case, small loaded images (pngs) as markers on an interactive matplotlib plot (using the OO approach). I'd potentially like to be able to point-pick these markers, too, as well as have them update appropriately if the plot is resized. The only example I've been to find of this is here: http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-with-plot But that is from 2 years ago. Is this way of doing it--which the author describes as a kludge--still the state of things, or is there a better approach now? (And right now this way isn't working for me...the images are down the bottom of the figure). Thank you, Che -- 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] 2 possible bugs with make_axes_area_auto_adjustable
On Mon, Feb 13, 2012 at 12:48 PM, C M cmpyt...@gmail.com wrote: I noticed what is causing one of these issues: 1) When I point-pick on the plot, the plot area still jumps (expands vertically a small amount). It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only. But is it possible it can be fixed so it doesn't jump at all? I see why this happens. When I point pick, a popup window pops up and covers the plot. I think this triggers a redraw. What causes the jump in my case is that the plot's title is set, in y coordinate, to 1.04. That is, the line is this: self.subplot.title.set_y(1.04) This is interacting with the line in make_axes_area_auto_adjustable: if self.title.get_visible(): artists.append(self.title) I have a workaround for this, which is just using a tip from Jae Joon to me* from 3 years ago (!). Instead of setting the title offset as shown above, I set it in this fashion: self.subplot.titleOffsetTrans._t = (0., 20.0/72.) self.subplot.titleOffsetTrans.invalidate() And then this somehow doesn't interact with the make_axes_area_auto_ adjustable function. One problem down. (I hope it is OK that I am answering my own questions, but didn't want to leave them out there and have others bother to work on it). -Che * http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10259.html -- 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] 2 possible bugs with make_axes_area_auto_adjustable
I noticed what is causing one of these issues: 1) When I point-pick on the plot, the plot area still jumps (expands vertically a small amount). It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only. But is it possible it can be fixed so it doesn't jump at all? I see why this happens. When I point pick, a popup window pops up and covers the plot. I think this triggers a redraw. What causes the jump in my case is that the plot's title is set, in y coordinate, to 1.04. That is, the line is this: self.subplot.title.set_y(1.04) This is interacting with the line in make_axes_area_auto_adjustable: if self.title.get_visible(): artists.append(self.title) Essentially, it is getting the bbox, taking into consideration the plot's title and other artists. But if the title is set to greater than 1.00, when I point pick (and force a redraw?), it has to recalculate the plot's axes areas and it adjusts things, so the user sees the small vertical expansion (jump). The problem goes away if I set the plot's title to 1.00: self.subplot.title.set_y(1.00) *However, this puts the title too close to the top of the plot area for my aesthetic liking.* I'd prefer a little larger margin. There should be a simple fix that allows for the title to be a bit higher off the plot area and yet not cause this jump. It would be in the code at the end of this email, but i don't know enough about bbox to fix it yet...any hints? Thanks, Che def axes_get_tightbbox(self, renderer): return the tight bounding box of the axes. The dimension of the Bbox in canvas coordinate. artists = [] bb = [] artists.append(self) if self.title.get_visible(): artists.append(self.title) if self.xaxis.get_visible(): artists.append(self.xaxis.label) bbx1, bbx2 = axis_get_ticklabel_extents(self.xaxis, renderer, True) bb.extend([bbx1, bbx2]) if self.yaxis.get_visible(): artists.append(self.yaxis.label) bby1, bby2 = axis_get_ticklabel_extents(self.yaxis, renderer, True) bb.extend([bby1, bby2]) bb.extend([c.get_window_extent(renderer) for c in artists if c.get_visible()]) _bbox = mtransforms.Bbox.union([b for b in bb if b.width!=0 or b.height!=0]) return _bbox -- 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
[Matplotlib-users] 2 possible bugs with make_axes_area_auto_adjustable
Jae-Joon's code, make_axes_area_auto_adjustable has been a great help to dynamically resizing my plots' axes area--such an improvement. But there are two bugs I've noticed that I wonder if has been identified/fixed yet: 1) When I point-pick on the plot, the plot area still jumps (expands vertically a small amount). It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only. But is it possible it can be fixed so it doesn't jump at all? 2) I just noticed that if a plot is resized so that the window that the plot is embedded in is *narrower than the title on the plot*, the resizing of the axes area gets very messed up (it gets *much8 narrower than is necessary to fit the available area). I'm not sure what the best approach to fixing this is, since it's not ideal to have a title not fit the figure's area, either...is it possible to flow-wrap a plot title? Thanks, Che -- 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] Change xaxis labels
On Mon, Feb 6, 2012 at 9:23 AM, David Craig dcdavem...@gmail.com wrote: Hi, I have a plot and the xaxis shows number of seconds after a start point. I would like to convert them to days anyone know how to do this. I have looked at the documentation but cant find what I need. Couldn't you divide your data points by the conversion (86400) before plotting? E.g., 432,000 seconds then becomes 5 days. -- 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] How matplotlib got me a job
On Mon, Feb 6, 2012 at 2:59 PM, Benjamin Root ben.r...@ou.edu wrote: Alternate title: How I finally convinced my Dad that open-source can put food on the table. Since this entire story got started on this mailing list, I figured it would be appropriate to end it here. Inspiring and uplifting story, Ben. I'm glad you posted it. Congratulations on your new job! (That's also interesting that your father even knows what open-source is). Che -- 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
[Matplotlib-users] Show custom tool on NavToolbar staying pressed in
The standard navigation toolbar has tools that press in and stay pressed to put the interation into a mode, like zoom mode or pan mode. You press the zoom tool, it stays shown as pressed in while it's in that mode. I am trying to add a new custom tool to the toolbar, and want it to put things into a mode as well, and therefore stay pressed in until pressed again. How do I do that? This is using the wxAgg backend. I searched through backend_wxagg and backend_bases and couldn't figure it out. Normally in wxPython you specify the style of a tool as having, to quote its API, wxITEM_CHECK for a checkable tool (such tool stays pressed after it had been toggled) Here I didn't see any option for that. Thanks, Che -- 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] Show custom tool on NavToolbar staying pressed in
On Wed, Feb 1, 2012 at 5:25 PM, C M cmpyt...@gmail.com wrote: The standard navigation toolbar has tools that press in and stay pressed to put the interation into a mode, like zoom mode or pan mode. You press the zoom tool, it stays shown as pressed in while it's in that mode. CORRECTION: My mistake, it's not really shown pressed, more like selected, with a blue thin line highlighting its perimeter. In any case, it's a cue to the user that the UI is in that mode. That's what I'd like my custom tool to have. -- 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] no leading 0 on times from DateFormatter
On Mon, Jan 30, 2012 at 12:32 PM, Daryl Herzmann akrh...@iastate.eduwrote: On Sun, Jan 29, 2012 at 10:10 PM, C M cmpyt...@gmail.com wrote: If I use the DateFormatter, like this: mydateformatter = I'll get dates like (note the time part): Nov 27 2011 03:00 PM Instead, I'd like to lose the zero on times, like: Nov 27 2011 3:00 PM Is there a way to do that? I believe if you put a '-' sign in there, it will work DateFormatter(%b%d \n %-I:%M%p, self._tz) daryl Thanks, but that doesn't work. If I use that, I get all times listed as 1:00 AM. Che -- 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] Subplot x-tick labels overlap with each other and with titles
On Wed, Jan 4, 2012 at 2:19 PM, Benjamin Root ben.r...@ou.edu wrote: On Wednesday, January 4, 2012, jeffsp jef...@gmail.com wrote: plt.tight_layout(), sweet it still makes the labels too close to read, even if they don't overlap. that is, they're just a continuous string of numbers with no whitespace between. it does clean up the rest of the plot really nicely, though, without having to continually dick around with subplots_adjust Well, it is a new feature with plenty of room for improvements. Maybe some sort of mindist parameter would be useful to establish a minimum distance between text objects? Ben Root Something like that sounds good. If there were a way to make it the default that labels would never overlap (but that default could be toggled for those who, somehow, want to not be able to read their labels?), that strikes me as best. In the meantime, what are other ways to do this? -- 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
[Matplotlib-users] help with custom formatter rules
As related to another question(s) I've posted, can someone help with this custom formatter? This is for use in a FunctionFormatter to be used on the y axis to format the ticks (in particular, to remove them when not wanted). Example: def CustomFormatter(self,y,i): if y 0: return '' This says if the value of y 0, put nothing on the axis tick. QUESTION: How can I implement the following two sorts of rules in Matplotlib's (OO) API? def CustomFormatter(self,y,i): if y falls in the bottom 50 pixels' worth of height of this plot: return '' or def CustomFormatter(self,y,i): if y falls in the bottom 10% of the height of this plot: return '' Thanks, Che -- 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] data free margin
I don't know if this will work for you, but in your situation I would probably just make another axis for the data with no y value. Like, a short squat axis directly below the main axis. -Jeff Thanks. That crossed my mind, but I never tried it yet. I thought it would take up too much vertical room in the display to have another axis just for what would likely be 1-2 data points worth of y-less data. I'd really want to not display the x axis for that one and just align it with the x axis of the main plot, but then the data points would be *below* the axis, and that would seem visually odd. I'll play with it in a sample app and see if I can get it to look good this way. Che -- 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] data free margin
On Tue, Nov 22, 2011 at 3:09 PM, Nicolas Rougier nicolas.roug...@inria.frwrote: Is that what you want ? No ticks, no labels: import matplotlib.pyplot as plt plt.plot(np.arange(10), np.arange(10)) plt.ylim(0,10) plt.yticks(np.linspace(3,10,8)) plt.show() Thanks. That works in your example, but in my actual code, it seems to override my custom formatter, and therefore messes up the axis formatting, which isn't going to work. Maybe I can integrate it into the formatter somehow. If anyone has related tips, please let me know. Che -- 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
[Matplotlib-users] data free margin
What's the best way in Matplotlib to have a y axis that doesn't have ticks/axis numbers near the bottom of the graph? I don't know if it would be specified as the bottom 1/10th of the graph or x amount of pixels or inches or whatever...just need a bit of extra y-less space there to plot values that have an x value but no y value. I'm assuming this would be done with a Formatter or Locator, but wasn't sure how to go about it. See attached image Thanks, Che attachment: y_axis_lower_margin.jpg-- 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] question about tight_layout()
In your example code, do you see the error raised only when you include the tight_layout call? Yes. To see this (at least on my platform), you take the example code and try two things: 1) Comment IN this line: self.panel.Layout(). Run it and you'll get the error. 3) Now comment OUT the tight_layout() call. Run it and you won't get the error. So you have to Layout() a parent panel (the one the canvas is sitting on) for this error to occur, but that is a common thing to do in wxPython when using sizers and shouldn't cause errors. Here is the traceback: Traceback (most recent call last): File C:\Documents and Settings\user\Desktop\testing_tight_layout.py, line 35, in module frame = Frame1(None) File C:\Documents and Settings\user\Desktop\testing_tight_layout.py, line 14, in __init__ self.Add_MPL_Plot() File C:\Documents and Settings\user\Desktop\testing_tight_layout.py, line 30, in Add_MPL_Plot self.figure.tight_layout() File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 1393, in tight_layout self.subplots_adjust(**kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 1218, in subplots_adjust self.subplotpars.update(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 183, in update raise ValueError('left cannot be = right') ValueError: left cannot be = right I just don't understand what this means and why it would be thrown. Anyhow, your code runs fine in my installment, linux + python 2.7.2 + wxgtk 2.8.11.0 + mpl master branch. On which platform you're running this? WinXP, Python 2.5, wxPython 2.8.10.1 (msw-unicode), mpl 1.1.0 as downloaded from the site three days ago. When you say the code runs fine, did you try steps (1) and (2) above? Also, if you just run it without making those changes, does the tight_layout() work to resize the plot such that it allows the axis labels to be seen at all times? (it doesn't for me). So, to summarize: - Error if I call self.panel.Layout() before I call tight_layout(). - If I don't do this, no error, but it still isn't doing a proper tight layout. Thanks, Che -- 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. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] question about tight_layout()
So, it seems that the issue is platform-dependent. OK. As for the error message, it seems that the subplot_params values (left, right, top, bottom, etc) calculated by the tight_layout routine is somehow corrupted. Why this happens is hard to track down unless I can reproduce the error. And I hope any other windows developer out there can take a look at this issue. Meanwhile, can you play a little bit more with your script? 1) check the size of the figure (print self.figure.get_size_inches()) before a tight_layout is called. What it prints is this: [ 8. 6.] 2) see if calling the draw method (self.canvas.draw()) before the tight_layout helps. It didn't help. Also, please open a git issue on this so that others can take a look. Sure. It's issue #532. (I tried to include the sample script but the indenting got removed from the issue window, not sure how to fix that). Thanks, Che -- 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. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] question about tight_layout()
On Sat, Oct 15, 2011 at 10:15 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: Figure.tight_layout() is a correct way. Do you see that error only when you use Figure.tight_plot (and not when you use plt.tight_layout)? Yes. What happen you try the script below. import matplotlib.pyplot as plt fig = plt.figure(1)ax = fig.add_subplot(111)fig.tight_layout() That runs without error. However, I can't get it to work correct with Figure. I'm either getting that same error or failure to adjust the Figure's size to accommodate the axes' labels. I attach a minimal runnable sample that demonstrates these problems for those that embed in wxPython. Thanks, Che testing_tight_layout.py Description: Binary data -- 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. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] question about tight_layout()
Just trying out the latest mpl 1.1.0 and the tight_layout() method. I saw the guide written about it, but am a unsure how to use this when using the OO approach to using Matplotlib. When using pyplot, the method is: plt.tight_layout(). When using the OO form of mpl, is it: figure.tight_layout() ? I assume it is, because I tried this and it didn't give me a name error, but I did get an error: ValueError: left cannot be = right. What am I doing wrong? Thanks, Che -- 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. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do you Plot data generated by a python script?
The problem is that I have a data set with ~1250 so I cant' do the sorting or finding the mean by hand. That's not a problem--that's programming! Even if you had a data set with five items you should be in the mind set that by hand is an 18th century approach. This will drive further progress in your coding abilities. I think you really need to read up on the NumPy documentation. There are functions that will do this for you. NumPy can load/save data, sort them, bin them, find means and standard deviations, etc... You don't need to re-invent the wheel. Ben, that's a good idea. The only thing here, though, is that probably the OP would be well served in practicing Python basics and learning how to think up procedures, write them down, and then put them into Python code. Re-inventing the wheel, *at least to learn* could really be useful here. I've also found that sometimes it is easier to just reinvent a wheel than learn a library's API, at least to get started. Considering his task requires mostly just creating lists based on conditionals and then doing some 5th grade math, he might want to try it himself before he uses NumPy. But of course he can get there either way. Che -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do you Plot data generated by a python script?
On Sat, Sep 3, 2011 at 7:32 PM, mdekauwe mdeka...@gmail.com wrote: So you do want a histogram then? I assume you have all of this sorted then, the histogram function is very good. I don't think he's describing a histogram, because he is not plotting frequency of observations on the y axis, but data values (means of each bin). I think what surfcast23 wants is just a bar graph. So, surfcast23, I'd suggest you break it down into your two steps. First, how will you average your values by bin? You can probably figure that out by writing it out on paper in pseudo-code and then just putting it in Python. Then you'll have a list of means, and you will pass that to the bar function in matplotlib, something like: from pylab import * ax = subplot(111) x = arange(4) your_list_of_means = [4,5,7,11] #computed earlier bar(x, your_list_of_means) xticks( x + 0.5, ('Bin1', 'Bin2', 'Bin3', 'Bin4') ) show() Che -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do you Plot data generated by a python script?
On Thu, Aug 25, 2011 at 10:01 PM, surfcast23 surfcas...@gmail.com wrote: Hi, there is only one column. so I want a plot of y and x. With y taking values running from 0 to n or 7 in my example and x as the average of the values that are contained in the rows in my example it was 5.57. It seems to me that, as described, you want a plot that in which all the bars are the same height (or width if it is a sideways bar chart), in this case, 5.57. That makes no sense. What information is this plot is intended to provide the viewer? -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] center figure.suptitle with axes.set_title
For a figure with just one subplot, I want to have a larger main title (using figure.suptitle) and a smaller subtitle (using axes.set_title). However, using horizontalalignment = 'center' on both the suptitle and title doesn't center the two relative to each other, because my subplot varies in width (I change it depending on the y axis labels' lengths). How can I center the suptitle appropriately over the subplot? Thanks, Che -- 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] simple question about locator every 0.5
Sorry, this is super-simple, but I'm lost in the whole locator/formatter part of the docs. How can I make a locator that just places a tick at every multiple of 0.5 around the data? So the y axis would look like: 3.5 -- 3.0 -- 2.5 -- 2.0 -- 1.5 -- 1.0 -- etc. Thanks, Che -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] simple question about locator every 0.5
On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg gbuchh...@infiniacorp.com wrote: -Original Message- From: C M [mailto:cmpyt...@gmail.com] Sorry, this is super-simple, but I'm lost in the whole locator/formatter part of the docs. How can I make a locator that just places a tick at every multiple of 0.5 around the data? So the y axis would look like: 3.5 -- 3.0 -- 2.5 -- 2.0 -- 1.5 -- 1.0 -- Do you want something like: ylim(1.0,3.5) yticks(arrange(1.0,4.0,0.5)) I'm not sure, because I can't try it out--I'm using the OO matplotlib, not Pyplot. What's the equivalent of this in the OO API? Thanks, Che -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] simple question about locator every 0.5
On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever gokhanse...@gmail.com wrote: On Wed, Jul 20, 2011 at 5:41 PM, C M cmpyt...@gmail.com wrote: On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg gbuchh...@infiniacorp.com wrote: -Original Message- From: C M [mailto:cmpyt...@gmail.com] Sorry, this is super-simple, but I'm lost in the whole locator/formatter part of the docs. How can I make a locator that just places a tick at every multiple of 0.5 around the data? So the y axis would look like: 3.5 -- 3.0 -- 2.5 -- 2.0 -- 1.5 -- 1.0 -- Do you want something like: ylim(1.0,3.5) yticks(arrange(1.0,4.0,0.5)) I'm not sure, because I can't try it out--I'm using the OO matplotlib, not Pyplot. What's the equivalent of this in the OO API? ax.axis((xmin, xmax, ymin, ymax)) ax.yaxis.set_ticks(np.arange(1.0, 4.0, 0.5)) Thanks. But in order to use this, I have to know ymin and ymax, based on the data. But I thought this was the point of the locators--that they could assign the ticks based on the range of the data and then some rule about placement of ticks in that range. But when I look at the various kinds of locators in the docs, none have a parameter that is equivalent to the 0.5 above in set_ticks. Or do they and I just missed it? -- 5 Ways to Improve Secure Unified Communications Unified Communications promises greater efficiencies for business. UC can improve internal communications as well as offer faster, more efficient ways to interact with customers and streamline customer service. Learn more! http://www.accelacomm.com/jaw/sfnl/114/51426253/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] help with code for DurationFormatter
A runnable code sample is attached. I'm trying to plot durations in time (sec to hours) on the y axis such that if you zoom, it changes the units and axis label appropriately. When run, it looks right. But, when I zoom on the first point, it is shown on the y axis at '0.20' minutes. I would like it to say '12 seconds'. I would think the FuncFormatter I am trying to use should be able to do that, but I cannot figure it out. For now, those attempts are commented out in the code. How can I create a formatter such that zooming changes the tick and axis labels in this way? Any help is appreciated. Thanks, Che duration_plot.py Description: Binary data -- 5 Ways to Improve Secure Unified Communications Unified Communications promises greater efficiencies for business. UC can improve internal communications as well as offer faster, more efficient ways to interact with customers and streamline customer service. Learn more! http://www.accelacomm.com/jaw/sfnl/114/51426253/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] simple question about locator every 0.5
Try MultipleLocator: from matplotlib.ticker import MultipleLocator halflocator = MultipleLocator(base=0.5) ax.xaxis.set_major_locator(halflocator) etc. Thanks, that works for me. I didn't think I could use non-integers (0.5) because the docs said, Set a tick on every integer that is multiple of base in the view interval. Earlier in that page, though, it does say base can be an integer or float. Che -- 5 Ways to Improve Secure Unified Communications Unified Communications promises greater efficiencies for business. UC can improve internal communications as well as offer faster, more efficient ways to interact with customers and streamline customer service. Learn more! http://www.accelacomm.com/jaw/sfnl/114/51426253/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot duration given format of '3:04:02.994000'
On Mon, Jul 18, 2011 at 10:58 AM, Daniel Mader danielstefanma...@googlemail.com wrote: Hi, why don't you just parse the returned string? asdf = '3:04:02.994000' asdf = asdf.split(':') temp = asdf[-1].split('.') print asdf asdf.pop(-1) print asdf asdf.extend(temp) print asdf asdf = [int(i) for i in asdf] print asdf hrs,mins,secs,usecs = asdf That should work, and you can always transform this into some common unit, e.g. seconds etc. Thanks. The issue, though is that I don't want to display a graph with seconds, but with whatever units is most suitable, since my data is going to range from seconds to hours. If most datapoints are hours, I don't want things expressed in terms of 5000 seconds. I thought there might be a way to use a DateLocator or DateFormatter with this kind of data so that it could pick the most suitable units based on a standardized time duration string. So do people think I have to create my own custom locator or formatter to do this? Thanks, Che -- Storage Efficiency Calculator This modeling tool is based on patent-pending intellectual property that has been used successfully in hundreds of IBM storage optimization engage- ments, worldwide. Store less, Store more with what you own, Move data to the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot duration given format of '3:04:02.994000'
This a time duration in my database: '3:04:02.994000' (i.e., 3 hrs, 4 min, 2 sec and 994 microsec). It's a string. Is there a way to allow Matplotlib to interpret that directly as a duration of time? Thank you. -- AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on Lean Startup Secrets Revealed. This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] formatter for durations of varying units
On Tue, Jul 12, 2011 at 3:15 AM, Maximilian Trescher fau...@trescher-it.de wrote: Hi, I want to pick a good (dynamic, for zooming) way to format the y axis. There are two issues: Does (1) seem like the right approach? And for 2, is there already a formatter that is appropriate for this or could be adapted to it? did you try the AutoDateLocator (from matplotlib.dates)? I hadn't. I am trying now but am stuck on: How can I plot the data given that, from the database, each datapoint is of the form ''0:00:02.994000'? Is there a way to tell matplotlib to read that as a time duration? Thanks, Che -- AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on Lean Startup Secrets Revealed. This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] formatter for durations of varying units
I need to make a dates (on x) vs. durations of time (on y) plots and need to have smart formatting for the y axis. My y data is in the database in the format: '0:00:02.994000', (that is, 2.9 seconds) and I'd like the y axis to be expressed in ticks of, e.g., 2 hrs, or 10 minutes, or 25 seconds, whichever is applicable...see below. The data could range from as little as a few seconds to more than 12 hours. Sometimes there will be outliers that are in a different unit. E.g., there may be a plot in which most durations are 1-3 hrs, but now and then there is a datapoint of 5 minutes, or even 30 seconds. Or it could be another one with mostly datapoints in minutes, but an occasional long or short one in hours or seconds. I want to pick a good (dynamic, for zooming) way to format the y axis. There are two issues: 1) Should I analyze the data to see what units the majority of datapoints are in and then use that as the y axis units before zooming? That is, if most are durations of minutes, then the y axis should be given in minutes. If most are in hours, the y axis should be hours, etc... This way the formatting is appropriate for the majority of the data displayed. 2) If a plot's y units are given in terms of minutes (because of point #1), but a user wants to zoom in on a datapoint that is only a few seconds, I'd like the formatter to change the y scaling to be in terms of seconds. I don't want to have express durations on the y axis as anything like 0.0335 minutes, but rather 2 seconds. Does (1) seem like the right approach? And for 2, is there already a formatter that is appropriate for this or could be adapted to it? Suggestions welcome. Thanks, Che -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of 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-d2d-c2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mpl newbie question...
I do not know the first thing about Python language.But things are not going well That's not a but but an of course. How could they possibly go well already? It takes time to learn something. You will get there, bit by bit. and I do not want to use any other programs such as GNUplot or other such open source programs which run on my linux machine and I am not purchasing any anything developed by Micro$oft. I'm curious. Why not? I have come to a road block and need guidance regarding what materials (e.g. books) I should purchase to help teach myself python/mathplolib or how I should move forward to become proficient use mpl? For Python, there are tons of online tutorials such as Alan Gauld's as well as any number of books (Google for recommendations or search the Python Google Group for very many iterations of asking for recommendations). For specific questions, the Python tutor list is great, and now Stack Overflow is also very good. For specific Matplotlib questions beyond the tutorial or examples, either SO or this list is excellent. There is now a matplotlib book by Sandro Tosi, too. I know little or nothing now so any newbie advice is much appreciated. I recommend that you write down a set of goals for what you want to accomplish, and then tackle them one by one. -- vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery
On Fri, May 13, 2011 at 6:23 AM, Pauli Virtanen p...@iki.fi wrote: Thu, 12 May 2011 15:16:43 -0400, C M wrote: [clip: installing Python modules] Is there a step-by-step method on the website that shows how to do this? Here: http://docs.python.org/install/index.html Thanks, but I guess I can't install matplotlib since I can't build it, since I don't have VS2003. -- 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] another incorrectly clipped PNG in the gallery
On Wed, May 11, 2011 at 12:29 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: I think I fixed a similar bug at some point but I'm not sure if that is related with this. Are you using the *make_axes_area_auto_adjustable* from the current git master (check examples/axes_grid/make_room_for_ylabel_using_axesgrid.py)? If not can you try that? Also please post your code. It seems I can't build matplotlib from source. Would it be possible to attach the amended files to this list and I'll try them? Thank you, Che -- 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] another incorrectly clipped PNG in the gallery
On Thu, May 12, 2011 at 1:26 PM, Michael Droettboom md...@stsci.edu wrote: You can always get a tarball of the current git master by going here: https://github.com/matplotlib/matplotlib clicking on Download and choosing one of the download source options at the top of the popup box. Mike Thanks, but I'm having trouble using that. I downloaded the .zip file, unzipped the archive, moved the folder to C:\Python25\Lib\site-packages, renamed my current matplotlib folder to matplotlib_OLD, ran these commands from the new directory: python setup.py build python setup.py install And finally renamed the new folder to just matplotlib. It is not finding the modules when I go to run it. If revert the names of the folders, my old folder still works. What am I doing wrong? Thanks, Che -- 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] another incorrectly clipped PNG in the gallery
On Thu, May 12, 2011 at 2:50 PM, Michael Droettboom md...@stsci.edu wrote: On 05/12/2011 02:34 PM, C M wrote: On Thu, May 12, 2011 at 1:26 PM, Michael Droettboommd...@stsci.edu wrote: You can always get a tarball of the current git master by going here: https://github.com/matplotlib/matplotlib clicking on Download and choosing one of the download source options at the top of the popup box. Mike Thanks, but I'm having trouble using that. I downloaded the .zip file, unzipped the archive, moved the folder to C:\Python25\Lib\site-packages, renamed my current matplotlib folder to matplotlib_OLD, ran these commands from the new directory: python setup.py build python setup.py install And finally renamed the new folder to just matplotlib. It is not finding the modules when I go to run it. If revert the names of the folders, my old folder still works. What am I doing wrong? You should not expand the directory tree under site-packages -- python setup.py install is what does that for you. You should expand it anywhere else (most people create a src directory somewhere on their machine for source code). Then run those commands. I unzipped it in a download directory, changed the directory to that folder, and ran the commands again...and it did not put a matplotlib folder under site-packages. Is there a step-by-step method on the website that shows how to do this? But all I really want is the changes that Jae Joon made as mentioned above. Is there a way to just grab them from the new folders? (I thought not because the folder structure from what I downloaded from git master doesn't match the folder structure I had from mpl 1.0, downloaded from the main mpl page). Thanks, Che -- 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] another incorrectly clipped PNG in the gallery
On Wed, May 11, 2011 at 11:07 AM, C M cmpyt...@gmail.com wrote: On Wed, May 11, 2011 at 12:29 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: I think I fixed a similar bug at some point but I'm not sure if that is related with this. Are you using the *make_axes_area_auto_adjustable* from the current git master (check examples/axes_grid/make_room_for_ylabel_using_axesgrid.py)? If not can you try that? Also please post your code. I have not set up with git since Matplotlib made the change from svn. I just downloaded git to get started but don't know how to use it yet; for now is there a way to just check out the files I need to test this, or is there some other (non-git) way to get this update? Thanks, Che -- 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] another incorrectly clipped PNG in the gallery
On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Thu, Sep 23, 2010 at 10:31 AM, C M cmpyt...@gmail.com wrote: Until a more permanent solution is figured out, can anyone recommend any workarounds, even if they are a little clunky? I'm embedding mpl plots in wxPython and am also finding this issue suboptimal. Che A (partial) workaround is possible using the axes_grid1 toolkit (i.e., you need matplotlib 1.0). Attached is a module I just cooked up (based on my previous attempt @ http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18129.html), and it seems to work quite well. The usage is simple. ax = plt.axes([0,0,1,1]) ax.set_yticks([0.5]) ax.set_yticklabels([very long label]) make_axes_area_auto_adjustable(ax) # This is where axes_grid1 comes in Then, the axes area(including ticklabels and axis label) will be automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the above case). While this is mainly for a single axes plot, you may use it with multi-axes plot (but somewhat trickier to use). A few examples are included in the module. Although this has been a big improvement, there is a lingering issue that I want to get around to cleaning up now. When I use this workaround that Jae Joon provided, it works just fine except that if I call canvas.draw() (because I am adding a star to a particular marker when point picking), it causes the whole canvas to jump a little bit. What happens is that on the first call to .draw() the plot area increases vertically a tiny amount and the title moves up slightly. On subsequent calls, the plot surface doesn't increase vertically but the title text moves slightly up and then down quickly. This happens each time I point pick for the first 5 or so times, and then it stops doing it. I don't even have to add any new points to the plot, just call canvas.draw() and it will do this. It is visually distracting and a look and feel demerit for the app for sure. I've tried to make a sample that is not embedded in wxPython but so far I can't reproduce the problem. Jae Joon or anyone, any ideas about why this is occurring and how to prevent it? If need be I will try to work up a sample that demonstrates it, but so far I've failed in that. Thanks, Che -- 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] UserWarning: Attempting to set identical bottom==top
On Fri, May 6, 2011 at 10:33 AM, Benjamin Root ben.r...@ou.edu wrote: On Thu, May 5, 2011 at 10:01 PM, C M cmpyt...@gmail.com wrote: Because you have a py2exe'ed program, I suspect that whoever packaged the program should be the one to modify that program to choose its axes limits more robustly in order to avoid the warning message. Maybe I have been unclear. I am the sole developer of this application, and I occasionally test it as a py2exe'd app in anticipation of delivering it in that form at some point. I would be happy to modify the program to choose its axes limits more robustly--if I only knew how to do that. That is what I am asking. How should I do that? The data to be plotted is a very simple date plot with dates on the x axis and values (formatted as time) on the y axis. Che Most likely, somewhere in your code, you have a call to set_ylim(), and are likely setting it to the minimum and maximum values of the data you are plotting. This is where the problem comes in. There are several options to go about avoiding the problem here. One is to not call set_ylim() at all if you have only one data point, and just let matplotlib figure out the y-limits automatically. Another approach is to call set_ylim() with parameters that have an explicit amount of padding, like the following: ax.set_ylim(y.min() - 0.5, y.max() + 0.5) This way, you are guaranteed that the top and bottom limits will never be the same. The best approach is up to you. I hope that helps! Ben Root Thank you, Ben! That helps a lot. Adding some padding myself seems to fix it. And it's good to understand what was occurring. -Che -- 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] UserWarning: Attempting to set identical bottom==top
On Thu, May 5, 2011 at 10:03 PM, C M cmpyt...@gmail.com wrote: On Thu, May 5, 2011 at 7:58 PM, Benjamin Root ben.r...@ou.edu wrote: On Sun, May 1, 2011 at 4:35 PM, C M cmpyt...@gmail.com wrote: I get this error and would like to know what to do to eliminate it and also what it means: C:\Python25\lib\site-packages\matplotlib\axes.py:2571: UserWarning: Attempting to set identical bottom==top results in singular transformations; automatically expanding. bottom=0, top=0 + 'bottom=%s, top=%s') % (bottom, top)) This is with Matplotlib 1.0.0. Thank you, Che I have seen this happen when the plot is set to use the limits of the data to guide the axes limits, but the data being displayed is either vertical or horizontal. What do you mean by the data being vertical or horizontal? I can get this error with a single point that is plotted on a time vs. values plot. It isn't a huge issue as the code is automatically padding the axes to make take the plot out of flat world. The problem is, when I use a py2exe'd app this error occurs and the user sees a message to see the log file for the error. I don't want that at all. It's a bad user experience. Is there a way I can prevent this error from ever being generated? Thanks. -- 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] UserWarning: Attempting to set identical bottom==top
Because you have a py2exe'ed program, I suspect that whoever packaged the program should be the one to modify that program to choose its axes limits more robustly in order to avoid the warning message. Maybe I have been unclear. I am the sole developer of this application, and I occasionally test it as a py2exe'd app in anticipation of delivering it in that form at some point. I would be happy to modify the program to choose its axes limits more robustly--if I only knew how to do that. That is what I am asking. How should I do that? The data to be plotted is a very simple date plot with dates on the x axis and values (formatted as time) on the y axis. Che -- 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
[Matplotlib-users] get bboxes of bars in data coordinates
I need to get the bboxes for time-range bars (matplotlib.patches.Rectangle objects) on a bar plot for a custom autoscaling function. Right now, I get them like this, where rectObj = a bar and bboxes = a list of bboxes: bboxes.append(rectObj.get_path().get_extents()) print 'bboxes is: ', bboxes However, the print shows bboxes to be: bboxes is: [Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]])), Bbox(array([[ 0., 0.], [ 1., 1.]]))] This is not what I need, because these points have nothing to do with the y axis I'm scaling (in fact, what do they mean?). Instead, I need bboxes that look more like this: bboxes is: [Bbox(array([[ 734190.02541214, 730844.2917], [ 734223.88252666, 730844.375 ]]))] (Although this is from getting the bboxes from a line, not a set of bars) These are in the floating point version of a date, which is what the y axis is scaled in. How can I get the bboxes of these bars in those coordinates? Thanks, Che -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] get bboxes of bars in data coordinates
I should add, I can see that (I think) this needs to use a transform to get it in data coordinates, because if I do this to each rectObj (each bar): trans = rectObj.get_patch_transform() print 'trans is: ', trans I get: trans is: BboxTransformTo(Bbox(array([[ 734189.52541214, 730844.], [ 734190.52541214, 730844.]]))) Which shows the data-coordinate bboxes in there, but that's now a BboxTransformTo object, not a Bbox object. I'm just don't know what method turns a display-coordinate bbox into a data-coordinate bbox. Thanks, Che -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] get bboxes of bars in data coordinates
On Mon, Mar 28, 2011 at 1:44 PM, C M cmpyt...@gmail.com wrote: I need to get the bboxes for time-range bars (matplotlib.patches.Rectangle objects) on a bar plot for a custom autoscaling function. Right now, I get them like this, where rectObj = a bar and bboxes = a list of bboxes: bboxes.append(rectObj.get_path().get_extents()) print 'bboxes is: ', bboxes OK, I have it... Because I was using the above to get the bbox for a Line2D object, I didn't realize there was already a method to get the bbox (in data coordinates) from a Rectangle: rectObj.get_bbox() -Che -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] exclude lines from a loose_autoscale_view function
I'm not sure if this is going to work to solve an issue I'm having, but I'd like to try it before asking a much more complex question. I have a function, loose_autoscale_view(), that is based on the autoscale_view function in mpl but allows margin arguments to push the margins out a bit more. I'd like to try to alter it to allow certain lines belonging to an axis to not be taken into consideration when autoscaling. I can alter it to accept a list of lines to be excluded, but then I don't know how to exclude them when calculating the autoscaling. I think the key line in the function is this one: bb = mtransforms.BboxBase.union(dl) because that union gets the sub-BBoxes for all the lines...so is there a way to exclude some? Or is there a better approach? Thanks. The function is below. -Che def loose_autoscale_view(self, subplot, xmargin, ymargin, tight=False, scalex=True, scaley=True): autoscale the view limits using the data limits. You can selectively autoscale only a single axis, eg, the xaxis by setting *scaley* to *False*. The autoscaling preserves any axis direction reversal that has already been done. I have added a way to make it not quite so tight using xmargin and ymargin. # if image data only just use the datalim #if not self.subplot._autoscaleon: return if scalex: xshared = subplot._shared_x_axes.get_siblings(subplot) dl = [ax.dataLim for ax in xshared] bb = mtransforms.BboxBase.union(dl) xdiff = bb.intervalx[1] - bb.intervalx[0] x0 = bb.intervalx[0]-xdiff * xmargin x1 = bb.intervalx[1]+xdiff * xmargin if scaley: yshared = subplot._shared_y_axes.get_siblings(subplot) dl = [ax.dataLim for ax in yshared] bb = mtransforms.BboxBase.union(dl) y0_untampered = bb.intervaly[0]-(bb.intervaly[1]) y0 = bb.intervaly[0]-(bb.intervaly[1]* ymargin) y1_untampered = bb.intervaly[1] y1 = bb.intervaly[1]* (1+ymargin) if (tight or (len(subplot.images)0 and len(subplot.lines)==0 and len(subplot.patches)==0)): if scalex: subplot.set_xbound(x0, x1) if scaley: subplot.set_ybound(y0, y1) return if scalex: XL = subplot.xaxis.get_major_locator().view_limits(x0, x1) subplot.set_xbound(XL) if scaley: YL = subplot.yaxis.get_major_locator().view_limits(y0, y1) subplot.set_ybound(YL) -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] onpick on a 2 y plot ( via twinx() ) seems to only allow picking of second axes's artists
On Thu, Jan 20, 2011 at 4:44 AM, Stephan Markus zw...@web.de wrote: Hello! I am also using two axes in a plot and want to be able to pick the lines of both axes. So far I used MPL 0.99.3 and a button on my interface to change the z-order of the axes in order to be able to pick lines of the active axes and to see the correct x/y data in the navigation toolbar. The callback code of my button is basically the code from othererik. Since MPL 1.0.0 I have the problem that lines of the second axes simply disappear from the plot whenever the plot is redrawn and it's zorder is higher. This thread, in which I asked a similar question and receive a workable solution from JJ, might be helpful. I am now just automatically moving all my lines over to the highest z-order axis so that whatever is visible is pickable. (But see below for a gotcha) http://old.nabble.com/unable-to-point-pick-2nd-axis-after-upgrade-to-mpl-1.0-td30400311.html On this note, to the developers: This need to take into account the z-order for picking lines has made my development more difficult. I have had a week's delay due to a difficult-to-understand bug in my code in which I prematurely moved the line over to the highest z-order axis, and then tried to format the axis with a custom formatter--causing an error. Simply moving the line only after all formatting is done fixed the bug, but that wasn't obvious for a while. The need to track which lines are on which z-order and to move them only after all formatting/locating has been done on them strikes me as a new gotcha that the simpler and more intuitive approach of if you can see it, you can pick it didn't have. (I have a somewhat complex case, though, in which there are three possible sorts of axes that could wind up on either the right or left sides). It also seems counter-intuitive that a line can belong to an axis from the in Matplotlib and yet for the user it clearly is measured using the other axis. Could z-order mattering be toggled? Anyway, my 2 cents. Thanks, Che -- 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] too many values to unpack with a bar chart
Hi Paul, The reason you were getting that error is because unless you specify otherwise, ax.bar will make the bottom of the bars at 0 - which isn't an allowed date, hence the error. Change your bar line to this (I also added align='center', but you can remove it if you want): Aha, OK that makes sense. Thank you. I think the point #3 in my previous email about the Ordinal must be = 1 has all been about what is or isn't allowed as a proper date. So your example worked of course, but I am still not able to get my real code to plot a bar chart. If I tell you what the format of the data is, maybe you can help me. I would like to plot dates (on x axis) versus time intervals (on y). I have a list of dates and I have a two lists (self.data[0] and self.data[1]), one of the start times (bots) and one of the stop times (tops). But when I go to plot it, and do this (based on your code...for now leaving out the round() step): bots = self.data[0] tops = self.data[1] bars = self.subplot.bar(self.final_dates, top-bot, bottom=bot, align='center') I get the error: TypeError: unsupported operand type(s) for -: 'list' and 'list' Because I am trying to subtract the bots list from the tops list. In the example code I gave, bot and times were not lists but were a 'numpy.ndarray' and a numpy.float64' object, respectfully, and I guess the - operand can be used on them. How can I structure my data such that this can work? (For some reason I have not had nearly this much confusion with plotting lines, just bars). Thanks for all the help, Che (CM) -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] too many values to unpack with a bar chart
just make a numpy array out of your two lists, and you'll be able to subtract one from the other. import numpy as np top = np.array(top) bot = np.array(bot) Thank you, Paul. That worked and I'm now able to display bar charts. I appreciate it. Best, Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] too many values to unpack with a bar chart
I usually do this for line graphs with markers: line, = self.subplot.plot_date(dates,data) along with some keywords to tweak the plot. I then add line to a dictionary to keep track of it: self.line_to_data_dict[line] = self.activity But today I tried this with a bar chart, just changing plot_date to bar and renaming the line, to bars,: fake_data = [2,2,5] bars, = self.subplot.bar(fake_data, fake_data ) This gave me the error: ValueError: too many values to unpack. OK, so if I removed the comma from bars, so it is just bars, it goes through but then I cannot add it to my dictionary--I get: TypeError: list objects are unhashable Help in understanding this and a better approach would be helpful. Thanks, Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] too many values to unpack with a bar chart
Just a thought, are you trying out the new legend code? I don't know if I am or not. But these problems are prior to any code regarding the legend. Could you do a print of the type for bars? When I write it as just bars without the comma it is: bars type = type 'list' If I write it with the comma ( bars,) then it won't even run because of the ValueError. I know the 2nd problem is that a dictionary cannot have a mutable object like a list as a key. But previously, as I said, I was able to call line, (with the comma) and it would work. In fact, line, with a comma gives this type: line type = class 'matplotlib.lines.Line2D' Thanks, Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] too many values to unpack with a bar chart
On Wed, Jan 26, 2011 at 9:16 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Thu, Jan 27, 2011 at 10:07 AM, C M cmpyt...@gmail.com wrote: I know the 2nd problem is that a dictionary cannot have a mutable object like a list as a key. But previously, as I said, I was able to call line, (with the comma) and it would work. In fact, line, with a comma gives this type: If you just want a hashable object, can you just cast it to a tuple? bars = self.subplot.bar(fake_data, fake_data ) bars_tuple = tuple(bars) bars_tuple can be used as a dictionary key. Yes, that can work, thanks, but I am still stuck without a bar chart for other reasons (see point #3 below), and I am still confused. I have some questions that if answered can hopefully help me get clearer: 1) What does the comma do exactly? If I put this: line, I create a matplotlib line object, whereas if I put just line I create a list. Does this mean that plot() in mpl returns a tuple that contains one element, which is a mpl line object? (If so, why doesn't it just return the line object itself?) 2) Why does line, followed by plot() return a mpl line object but bars, followed by bar() not return some kind of matplotlib object (like a line)? Why does it instead give the ValueError: Too many values to unpack error? 3) I am getting just hammered with the following error *a lot* in date plotting lately: ValueError: ordinal must be = 1 And I can't figure out what sorts of mistakes or situations are triggering it. More of the traceback above that error is at the end of this message. Does someone know when this error will be thrown when using dates so I can at least know what to check for in my data? Thanks, Che -- more of Traceback: for ylabel_i in self.subplot.get_yticklabels(): File C:\Python25\lib\site-packages\matplotlib\axes.py, line 2646, in get_yticklabels self.yaxis.get_ticklabels(minor=minor)) File C:\Python25\lib\site-packages\matplotlib\axis.py, line 1087, in get_ticklabels return self.get_majorticklabels() File C:\Python25\lib\site-packages\matplotlib\axis.py, line 1071, in get_majorticklabels ticks = self.get_major_ticks() File C:\Python25\lib\site-packages\matplotlib\axis.py, line 1169, in get_major_ticks numticks = len(self.get_major_locator()()) File C:\Python25\lib\site-packages\matplotlib\dates.py, line 743, in __call__ self.refresh() File C:\Python25\lib\site-packages\matplotlib\dates.py, line 752, in refresh dmin, dmax = self.viewlim_to_dt() File C:\Python25\lib\site-packages\matplotlib\dates.py, line 524, in viewlim_to_dt return num2date(vmin, self.tz), num2date(vmax, self.tz) File C:\Python25\lib\site-packages\matplotlib\dates.py, line 289, in num2date if not cbook.iterable(x): return _from_ordinalf(x, tz) File C:\Python25\lib\site-packages\matplotlib\dates.py, line 203, in _from_ordinalf dt = datetime.datetime.fromordinal(ix) ValueError: ordinal must be = 1 -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] too many values to unpack with a bar chart
3) I am getting just hammered with the following error *a lot* in date plotting lately: ValueError: ordinal must be = 1 OK, I made up a small runnable sample to show this with bar(). (Using code that someone else wrote[1]). This code runs when using plot_date(), but if you comment that out and comment in the ax.bar() line, it will give this ValueError. import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import datetime as dt # Make a series of events 1 day apart x = mpl.dates.drange(dt.datetime(2009,10,1), dt.datetime(2010,1,15), dt.timedelta(days=1)) # Vary the datetimes so that they occur at random times # Remember, 1.0 is equivalent to 1 day in this case... x += np.random.random(x.size) # We can extract the time by using a modulo 1, and adding an arbitrary base date times = x % 1 + int(x[0]) # (The int is so the y-axis starts at midnight...) # I'm just plotting points here, but you could just as easily use a bar. fig = plt.figure() ax = fig.add_subplot(111) #comment out: ax.plot_date(x, times, 'ro') #comment in #ax.bar(x, times) ax.yaxis_date() fig.autofmt_xdate() plt.show() [1]http://stackoverflow.com/questions/4790265/plot-time-of-day-vs-date-in-matplotlib -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] floating bar chart?
I looked through the gallery, but didn't see this one and am not sure how to create it. It would be a floating bar chart (or floating column chart), like what is seen here: http://peltiertech.com/Excel/pix1/BloodSugarFloater.gif Thanks, Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] floating bar chart?
On Mon, Jan 24, 2011 at 4:42 PM, Paul Ivanov pivanov...@gmail.com wrote: C M, on 2011-01-24 16:27, wrote: I looked through the gallery, but didn't see this one and am not sure how to create it. It would be a floating bar chart (or floating column chart), like what is seen here: http://peltiertech.com/Excel/pix1/BloodSugarFloater.gif Hi Che, just specify the 'bottom' keyword argument to bar. Note that the second parameter is height of the bar, *not* the top of the bar plt.bar([1,2,3,4], [2,2.5,5,3], bottom=[0,-1,1,2]) best, -- Paul Ivanov Thanks, Paul! Easy enough. -Che -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ 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
It will work if you explicitly set its transform. star, = ax.plot([xdata[ind]], [ydata[ind]], '*', ms=40, mfc='y', mec='b', transform=thisline.get_transform()) JJ, thank you, this worked in my app as well. I also use the identity of the picked line in my code, since I provide additional information about that data series to the user based on which line (and point) they picked. So if reparenting the line loses that information, that's going to be a problem. I believe that reparenting only changes the axes attribute of the line, so it might not be a problem. Yes, it turns out it doesn't seem to cause any problem, which is great. When I was using matplotlib 0.98.5.2, I had the same code as I have now, with two different axes, and pick events were picked up on lines belonging to either of the axes. Unless I'm misunderstanding, something has changed and this used to be possible. Is that correct? Yes, I believe this used to be possible. While I'm not sure why it changed, I'm also not sure if we need to revert this change as I personally prefer the current simple behavior (although there could be a room for improvement). And I want to hear what others think. You may file a new feature request (or a bug if you want) issue regarding this. I don't know if the other developers have weighed in on this in some other forum or in personal communication, but as a user my vote is to keep the old behavior. I don't know how much of a simplicity benefit the developer team gets, but as a user I doubt I would have been able to figure out your suggestions based on Matplotlib documentation alone, unless maybe I am missing something. The previous way it worked strikes me as the user-intuitive way; this new way requires you to move a line to an axis that it doesn't match but then use its transform to decode what it really should be (if I understand it about right). And then one has to do that for every line. That seems complex from the user's perspective. Now that it is all in place it is no problem, but getting here was tough and un-doable without help. I guess I will file a feature request or bug report about it. So thank you very much, JJ, for all your help on at least three key details that massively improve the user experience of the app I am trying to put together. And thanks to John and the rest of the developers for Matplotlib! Che -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery
On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Thu, Sep 23, 2010 at 10:31 AM, C M cmpyt...@gmail.com wrote: Until a more permanent solution is figured out, can anyone recommend any workarounds, even if they are a little clunky? I'm embedding mpl plots in wxPython and am also finding this issue suboptimal. Che A (partial) workaround is possible using the axes_grid1 toolkit (i.e., you need matplotlib 1.0). Attached is a module I just cooked up (based on my previous attempt @ http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18129.html ), and it seems to work quite well. The usage is simple. ax = plt.axes([0,0,1,1]) ax.set_yticks([0.5]) ax.set_yticklabels([very long label]) make_axes_area_auto_adjustable(ax) # This is where axes_grid1 comes in Then, the axes area(including ticklabels and axis label) will be automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the above case). While this is mainly for a single axes plot, you may use it with multi-axes plot (but somewhat trickier to use). A few examples are included in the module. Regards, -JJ This thread is a few months old now, but I just wanted to mention that I am using JJ's workaround (thanks!) in my app--with either one or two y axes--and it is just excellent. This should definitely be at least an option for matplotlib users--the quality of the appearance of the plots now is like night and day, because, to me, seeing a plot without its axes labels (I'm talking about in a resizable plot embedded in an application, not a static graph for inclusion in a publication) is a *major* look and feel demerit. Che -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ 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
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. import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax2 = ax.twinx() line, = ax.plot([1,2,3], 'r-o', markersize=15, picker=5) line2, = ax2.plot([4,2,12], 'b-o', markersize=15, picker=5) def onpick(event): print 'picked line: ', event.artist fig.canvas.mpl_connect('pick_event', onpick) plt.show() -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] unable to point pick 2nd axis after upgrade to mpl 1.0
Hello, list. I have created a runnable sample app that demonstrates the problem (mentioned also in another thread) in the subject line. The sample is: - mpl 1.0 embedded in wxPython using wxAgg backend. - using plot() for simplicity, but see same issue if it is plot_date(). (I do date plotting). - using twinx to have a 2nd axis (in the problematic case). - trying to have point picking on both axes. You can demonstrate the problem by first running the app and clicking on one red marker and then one blue marker. The message dialog will, each time, indicate the line/pos you picked, and it will work for both the red and blue markers. But then if you comment out line 52 and comment in line 56, thereby adding a second axis, you will find you can *only pick the red markers* (which are on the first axis). This problem did not occur in my previous (0.98.5.2) version of matplotlib. In addition, in my app, I also have a legend, and--only if I have a 2nd axis--I cannot pick that, either. (I kept it out of this sample to keep things simpler). Thank you for any help or suggestions to get this to work. -Che 2nd_axis_picking_problem.py Description: Binary data -- 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
[Matplotlib-users] what is line._invalid in matplotlib 1.0?
Hello. I upgraded from about mpl 0.98.5 to 1.0, and this code, which worked in 0.98.5: if line._invalid: line.recache() now gives this error: AttributeError: 'Line2D' object has no attribute '_invalid' What is now (1.0) the right way to test whether a Line2D object is invalid? Thanks very much, Che (This question is in another recent post of mine, but this is much more to the point) -- 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] what is line._invalid in matplotlib 1.0?
On Sun, Dec 5, 2010 at 9:33 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: Here is a modified version of the code. Note that since it uses non-public APIs, it may stop to work again in the future. According to your original post, you seem to want to pick up points only. I guess the better way is to have a separate artists. One for points and the other for line segments. JJ, Thank you very much. This is good to know. However, I had hoped that getting this check of the line's validity would clear up the main problem I've had since going to 1.0--but it did not, The problem is: Prior to upgrade, I could get picking on a) the legend, and b) all points on the graph, whether the graph had one y axis or two (using twinx). Now, after upgrade, if I only have one y axis, I can get fine point picking and legend picking, but if I have two y axes, I can't get legend picking and can only get point picking on the points that belong to the left y axis, not the right y axis. I get no errors, but no (full) point picking, either. I need to get this cleared up and I'd love to stay with 1.0, but I don't know what the issue might be. Che -- 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
[Matplotlib-users] upgrade to 1.0 help
Hello. I've decided to upgrade to matplotlib 1.0, but I'll need to fix a few problems that have come up. I was hoping I could get some help on this here. First thing is, I have a bit of point picker code that was written by JJ on this list some time back that has been working well. This is the start of it: def contains_points(self, line, mouseevent): line.pickradius = 5 # Make sure we have data to plot if line._invalid: line.recache() if len(line._xy)==0: return False,{} But I am getting an error: AttributeError: 'Line2D' object has no attribute '_invalid' Can someone please tell me what the right method is now? And how I can learn about these sorts of changes on my own? Thank you, Che -- Oracle to DB2 Conversion Guide: New IBM DB2 features make compatibility easy. Learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more - all designed to run applications on both DB2 and Oracle platforms. http://p.sf.net/sfu/oracle-sfdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] upgrade to 1.0 help
Hello. I've decided to upgrade to matplotlib 1.0, but I'll need to fix a few problems that have come up. I was hoping I could get some help on this here. Second problem: the grid background is gone despite these lines are not throwing any errors (here, self.subplot is an axis): self.subplot.grid(True) self.subplot.grid(color='0.75', linestyle='dotted', linewidth=0.1) I searched the docs for grid and so far haven't found the change. What is the right method now? Thanks, Che -- 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] upgrade to 1.0 help
On Fri, Dec 3, 2010 at 8:10 PM, C M cmpyt...@gmail.com wrote: Hello. I've decided to upgrade to matplotlib 1.0, but I'll need to fix a few problems that have come up. I was hoping I could get some help on this here. Second problem: the grid background is gone despite these lines are not throwing any errors (here, self.subplot is an axis): self.subplot.grid(True) self.subplot.grid(color='0.75', linestyle='dotted', linewidth=0.1) I searched the docs for grid and so far haven't found the change. What is the right method now? Ack, sorry for the noise. That does work (and I don't need the first line). It is just that the lines are so fine/faint now that I couldn't see them lines until I tilted the monitor and looked carefully. I'm guessing the change was because previous to mpl 1.0 a linewidth of 0.1 was below some minimal value and was treated as though it were 1? In any case, using linewidth=1 looks reasonable for me now. -cm -- 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] subclassing AutoDateFormatter correctly
On Wed, Dec 1, 2010 at 12:28 AM, Ryan May rma...@gmail.com wrote: On Tue, Nov 30, 2010 at 7:00 PM, C M cmpyt...@gmail.com wrote: Thanks, Ryan. I've done that now. I use the OOP approach to matplotlib and embed it in wxPython, so my example uses that. I did not know how to apply an AutoDateFormatter to an axis if using pylab and figured the basics of what I am trying to do are apparent from this sample. The sample is attached. The point of it is that, despite it apparently using my AutoDateFormatter, all the dates at all levels of zoom are %Y (e.g. 2010). This is because in the AutoDateFormatter subclass, the line: scale = float( self._locator._get_unit() ) is *always* returning 365.0. I am not bothering for now to include the business about how point-picking remedies my problem, because the AutoDateFormatter shouldn't need that--obviously, the way I am doing it is wrong, and I'd like to know what it is. I'm guessing your problem was that only the year was being shown, regardless? It would seem the problem stems from the fact that while you give your formatter the AutoDateLocator, you never tell the axis to use this. I got what I considered the correct behavior by adding the following line at linen 84 in the script: self.subplot.xaxis.set_major_locator(adl) Does adding that get you what you want? Ryan Yes, that was it! So simple, but I've been confused about how locators and formatters work together--now it makes much more sense. Thank you very much. Che -- Increase Visibility of Your 3D Game App Earn a Chance To Win $500! Tap into the largest installed PC base get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subclassing AutoDateFormatter correctly
On Sun, Nov 28, 2010 at 8:52 PM, C M cmpyt...@gmail.com wrote: How can I correctly subclass AutoDateFormatter and use it in my code? What I am doing is copying the code from matplotlib's AutoDateFormatter and changing the strings for how the dates are represented and making that a class, MyAutoDateFormatter. AutoDateFormatter expects a locator, and I think (?) the default is AutoDateLocator. So in my code I am doing this: adl = AutoDateLocator() myformatter = MyAutoDateFormatter(adl) axis.xaxis.set_major_formatter(myformatter) But when I run it, no matter the level of zoom, it says 2010 (when it should change depending on zoom level). However, if I go into the matplotlib dates.py code itself and save the same changes to the date strings there, and I comment out the above code, then it works: the date strings change depending on level of zoom. I've also just noticed that if I use the above code after the lines have been plotted, but then I click on one of the points (which causes a point-picking routine that ultimately plots a highlighting marker over that point), the x axis suddenly changes to use MyAutoDateFormatter's format strings. (If I call it before I plot anything, it doesn't help, though). Is the act of plotting somehow refreshing things? What can I call in order to force this to happen without actually plotting any additional points after my lines are plotted? Thanks, Che -- Increase Visibility of Your 3D Game App Earn a Chance To Win $500! Tap into the largest installed PC base get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subclassing AutoDateFormatter correctly
On Tue, Nov 30, 2010 at 12:23 PM, Ryan May rma...@gmail.com wrote: On Tue, Nov 30, 2010 at 10:44 AM, C M cmpyt...@gmail.com wrote: On Sun, Nov 28, 2010 at 8:52 PM, C M cmpyt...@gmail.com wrote: How can I correctly subclass AutoDateFormatter and use it in my code? What I am doing is copying the code from matplotlib's AutoDateFormatter and changing the strings for how the dates are represented and making that a class, MyAutoDateFormatter. AutoDateFormatter expects a locator, and I think (?) the default is AutoDateLocator. So in my code I am doing this: adl = AutoDateLocator() myformatter = MyAutoDateFormatter(adl) axis.xaxis.set_major_formatter(myformatter) But when I run it, no matter the level of zoom, it says 2010 (when it should change depending on zoom level). However, if I go into the matplotlib dates.py code itself and save the same changes to the date strings there, and I comment out the above code, then it works: the date strings change depending on level of zoom. I've also just noticed that if I use the above code after the lines have been plotted, but then I click on one of the points (which causes a point-picking routine that ultimately plots a highlighting marker over that point), the x axis suddenly changes to use MyAutoDateFormatter's format strings. (If I call it before I plot anything, it doesn't help, though). Is the act of plotting somehow refreshing things? What can I call in order to force this to happen without actually plotting any additional points after my lines are plotted? It's difficult to tell without seeing the code that's producing the problem. If you can boil your problem down to a simple, self-contained script and post it here, then we can take a look and see what's going on. Thanks, Ryan. I've done that now. I use the OOP approach to matplotlib and embed it in wxPython, so my example uses that. I did not know how to apply an AutoDateFormatter to an axis if using pylab and figured the basics of what I am trying to do are apparent from this sample. The sample is attached. The point of it is that, despite it apparently using my AutoDateFormatter, all the dates at all levels of zoom are %Y (e.g. 2010). This is because in the AutoDateFormatter subclass, the line: scale = float( self._locator._get_unit() ) is *always* returning 365.0. I am not bothering for now to include the business about how point-picking remedies my problem, because the AutoDateFormatter shouldn't need that--obviously, the way I am doing it is wrong, and I'd like to know what it is. Thanks for any help, Che plot_test.py Description: Binary data -- Increase Visibility of Your 3D Game App Earn a Chance To Win $500! Tap into the largest installed PC base get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] subclassing AutoDateFormatter correctly
How can I correctly subclass AutoDateFormatter and use it in my code? What I am doing is copying the code from matplotlib's AutoDateFormatter and changing the strings for how the dates are represented and making that a class, MyAutoDateFormatter. AutoDateFormatter expects a locator, and I think (?) the default is AutoDateLocator. So in my code I am doing this: adl = AutoDateLocator() myformatter = MyAutoDateFormatter(adl) axis.xaxis.set_major_formatter(myformatter) But when I run it, no matter the level of zoom, it says 2010 (when it should change depending on zoom level). However, if I go into the matplotlib dates.py code itself and save the same changes to the date strings there, and I comment out the above code, then it works: the date strings change depending on level of zoom. I could just leave it changed in mpl's dates.py module, but I'd rather subclass AutoDateFormatter so that if I share the source code of my app with others, it will get this right. What am I doing wrong? Thanks, and any help appreciated as always. Che -- Increase Visibility of Your 3D Game App Earn a Chance To Win $500! Tap into the largest installed PC base get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] date plot with two y axes...and some other things
On Thu, Nov 18, 2010 at 12:59 PM, C M cmpyt...@gmail.com wrote: Goals: date plot with two y axes (plotting completely different things) point picking and point labeling As many lines as user wants, all colored differently. Having some problems with this. (matplotlib 0.98.5) 1) There is a known bug with twinx() and plot_date: http://sourceforge.net/tracker/index.php?func=detailaid=3046812group_id=80706atid=560720 But I can get it to work if I change ONE OF the plot_date() calls (the one for the values plotted to the right-hand y axis) to just plot(). Is that going to introduce problems? Is there a better workaround? (The ones on that page don't work for me). So far, so good with this. But for others working on it, I have found that the *order* of plotting matters. That is, I have two axes and I have to use plot() for one axis and plot_date() for the other, but it must be plot() that is used first or else I will get the error: ValueError: ordinal must be = 1. I'm managing my lines and grouping them by axes, and then making sure I plot all the lines on the axis that uses plot() first. Seems to work fine after that. 3) My point picking is not working with the two axes. In my routine, I label the picked point and to do that I have to make reference to its axis and call plot_date(). How can I know which axis the picked point came from, so that I can label it appropriately? I should have just thought about that more. Of course, there is the method myline.get_axes() for that. Che -- Increase Visibility of Your 3D Game App Earn a Chance To Win $500! Tap into the largest installed PC base get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] date plot with two y axes...and some other things
Goals: date plot with two y axes (plotting completely different things) point picking and point labeling As many lines as user wants, all colored differently. Having some problems with this. (matplotlib 0.98.5) 1) There is a known bug with twinx() and plot_date: http://sourceforge.net/tracker/index.php?func=detailaid=3046812group_id=80706atid=560720 But I can get it to work if I change ONE OF the plot_date() calls (the one for the values plotted to the right-hand y axis) to just plot(). Is that going to introduce problems? Is there a better workaround? (The ones on that page don't work for me). 2) How can I get the lines belonging to different axes to cycle through colors such that the same color is not used for any lines shown in the plot? (that is, I don't want to hard code a color to any line, I want it to auto-cycle). 3) My point picking is not working with the two axes. In my routine, I label the picked point and to do that I have to make reference to its axis and call plot_date(). How can I know which axis the picked point came from, so that I can label it appropriately? Sorry this is a little stirred together, but hoping I can get some hints to allow me to work it into shape. Thanks, Che -- 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/msIE9-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] simpler example of embedding in wx
I'd like to offer a simplest possible example for embedding in wxPython; significantly simpler and completely pared down compared to either of the two that are shown here: http://www.scipy.org/Matplotlib_figure_in_a_wx_panel but I don't have access to modify the page. Doesn't anyone on the list have that access, and would that be welcome? My example is ~20 lines long. Thanks, Che -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] another incorrectly clipped PNG in the gallery
On Wed, Sep 22, 2010 at 6:16 PM, Eric Firing efir...@hawaii.edu wrote: On 09/22/2010 10:11 AM, Russell Owen wrote: On Sep 22, 2010, at 11:16 AM, Benjamin Root wrote: On Wed, Sep 22, 2010 at 12:04 PM, Russell E. Owen ro...@uw.edu mailto:ro...@uw.edu wrote: In article 4c935c08.1000...@gmail.com mailto:4c935c08.1000...@gmail.com, Alan G Isaac alan.is...@gmail.com mailto:alan.is...@gmail.com wrote: http://matplotlib.sourceforge.net/examples/pylab_examples/accented_text.html It's realistic, and that has a lot to be said for it. One of my problems with matplotlib is that it is far too willing to truncate axis labels and related information. I'd be much happier with a layout model that always showed the axis labels in full. Ditto on this. In addition, it would be useful to prevent axes labels from spilling over into another axes' area. I submitted bug report #3073546 on the issue of axis labels getting truncated. https://sourceforge.net/tracker/?func=detailatid=560720aid=3073546group_id=80706 https://sourceforge.net/tracker/?func=detailatid=560720aid=3073546group_id=80706 You might want to add your suggestion about axis labels or submit a new ticket. The problem is not a bug; it is inherent in the fundamental design. Therefore I moved the ticket over to feature requests. I want to keep the bugs list for real bugs that we can realistically expect to solve fairly quickly. I don't know whether Andrew Straw's wx sizer-inspired code (mplsizer toolkit) solves the problem or not. My impression is that it does not--I think it is working with the Axes positions, not with axis and tick labels, which are what cause most of the difficulties. Eric Until a more permanent solution is figured out, can anyone recommend any workarounds, even if they are a little clunky? I'm embedding mpl plots in wxPython and am also finding this issue suboptimal. Che -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] py2exe and matplotlib - Fonts: do I need them all?
On Thu, Sep 16, 2010 at 6:33 PM, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hello all, I'm new to py2exe but I managed to create a binary executable of my program. Now I'm experiencing on how to make the final size of the binary smaller. I already managed to cut about 15Mb by removing calls to pyQt (I use Wxpython) and also to scipy. One thing that is still bothering me is the mpl_data directory that holds about 3.5 Mb of fonts. Is it OK to remove the fonts I don't use? (I use only sans-serif) By Ok I mean not only from the practical poin tof view (that is, will the app run?) but also from the _legal_ point of view (am I obliged to distribute all those fonts?) And what about all thos .afm files? Are they needed? What are they really? I hope to find some answers from your experience. I think many would definitely benefit from knowing what can be left out and how to do it, even beyond what you have mentioned. I look forward to seeing whatever responses you might get. -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] progress bar?
On Mon, Jun 28, 2010 at 11:31 AM, Jim Vickroy jim.vick...@noaa.gov wrote: Carlos Grohmann wrote: I've been searching but coudn't find any example on how to add a progress bar to a wxpython+matplotlib app. I'd like my app to show a progress bar while some gridding and contouring are being done. Or, if you don't want a separate dialog popping up, just use wx.Gauge--it is a progress bar, and you can choose to put it near (maybe under) your plot in the layout. Che -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: install from svn on Linux not working for me
-- Forwarded message -- From: C M cmpyt...@gmail.com Date: Mon, Apr 19, 2010 at 1:02 PM Subject: Re: [Matplotlib-users] install from svn on Linux not working for me To: Darren Dale dsdal...@gmail.com On Mon, Apr 19, 2010 at 8:02 AM, Darren Dale dsdal...@gmail.com wrote: On Mon, Apr 19, 2010 at 4:30 AM, LUK ShunTim lukshun...@gmail.com wrote: On 04/19/2010 01:52 PM, C M wrote: My goal is to just get the lastest svn version of matplotlib, or, if not that, just the 0.99 version, up and working on my Linux (Intrepid Ibex) computer. I checked it matplotlib out from svn fine, and then, as per the webpage, did: cd matplotlib python setup.py install and that resulted in a very large amount of errors. I'll post them at the bottom of this message, since there are many lines. I previously had 0.98.x installed, via the Ubuntu repositories, but I have uninstalled it. My version is: Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008 x86_64 GNU/Linux Any help is appreciated. Thank you, Che Errors (starting from a few lines before): creating build/temp.linux-x86_64-2.5/src creating build/temp.linux-x86_64-2.5/CXX gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/lib/python2.5/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/lib/python2.5/site-packages/numpy/core/include/freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/include/python2.5 -c src/ft2font.cpp -o build/temp.linux-x86_64-2.5/src/ft2font.o cc1plus: warning: command line option -Wstrict-prototypes is valid for Ada/C/ObjC but not for C++ In file included from ./CXX/Extensions.hxx:37, from src/ft2font.h:4, from src/ft2font.cpp:1: ./CXX/WrapPython.h:58:20: error: Python.h: No such file or directory You seem not to have the development package of python installed. Try sudo apt-get install python-dev. It looks like you are need to install libfreetype6-dev. Any time you see missing .h files in your output, it means you need to install the development headers for that package. Darren Thanks, but after installing libfreetype6-dev, I tried to install matplotlib again and still get a lot of errors. Listed below. Che Ouput of install: basedirlist is: ['/usr/local', '/usr'] BUILDING MATPLOTLIB matplotlib: 1.0.svn python: 2.5.2 (r252:60911, Jan 20 2010, 23:33:04) [GCC 4.3.2] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.1.1 freetype2: 9.18.3 OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/local/include', '/usr/include', '.' Tkinter: no * TKAgg requires Tkinter wxPython: 2.8.10.1 * WxAgg extension not required for wxPython = 2.8 pkg-config: looking for pygtk-2.0 gtk+-2.0 * Package pygtk-2.0 was not found in the pkg-config * search path. Perhaps you should add the directory * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH * environment variable No package 'pygtk-2.0' found * Package gtk+-2.0 was not found in the pkg-config * search path. Perhaps you should add the directory * containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH * environment variable No package 'gtk+-2.0' found * You may need to install 'dev' package(s) to * provide header files. Gtk+: no * Could not find Gtk+ headers in any of * '/usr/local/include', '/usr/include', '.' Mac OS X native: no Qt: no Qt4: no Cairo: 1.4.12 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.4 pytz: 2008b OPTIONAL USETEX DEPENDENCIES dvipng: 1.11 ghostscript: 8.63 latex: 3.141592 pdftops: 3.00 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.numerix
[Matplotlib-users] Fwd: install from svn on Linux not working for me
-- Forwarded message -- From: C M cmpyt...@gmail.com Date: Mon, Apr 19, 2010 at 12:58 PM Subject: Re: [Matplotlib-users] install from svn on Linux not working for me To: LUK ShunTim lukshun...@gmail.com On Mon, Apr 19, 2010 at 4:30 AM, LUK ShunTim lukshun...@gmail.com wrote: On 04/19/2010 01:52 PM, C M wrote: My goal is to just get the lastest svn version of matplotlib, or, if not that, just the 0.99 version, up and working on my Linux (Intrepid Ibex) computer. I checked it matplotlib out from svn fine, and then, as per the webpage, did: cd matplotlib python setup.py install and that resulted in a very large amount of errors. I'll post them at the bottom of this message, since there are many lines. I previously had 0.98.x installed, via the Ubuntu repositories, but I have uninstalled it. My version is: Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008 x86_64 GNU/Linux Any help is appreciated. Thank you, Che Errors (starting from a few lines before): creating build/temp.linux-x86_64-2.5/src creating build/temp.linux-x86_64-2.5/CXX gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/lib/python2.5/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/lib/python2.5/site-packages/numpy/core/include/freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/include/python2.5 -c src/ft2font.cpp -o build/temp.linux-x86_64-2.5/src/ft2font.o cc1plus: warning: command line option -Wstrict-prototypes is valid for Ada/C/ObjC but not for C++ In file included from ./CXX/Extensions.hxx:37, from src/ft2font.h:4, from src/ft2font.cpp:1: ./CXX/WrapPython.h:58:20: error: Python.h: No such file or directory You seem not to have the development package of python installed. Try sudo apt-get install python-dev. Regards, ST Well, I now did that and I still get lots of errors The full output of the terminal is listed below. Why is this so much more difficult than the website suggests? Am I going to need to take this all into account if I want to distribute a packaged-up version of my application on Linux? This is the first time I've run into these problems. Thanks, Che Terminal output: basedirlist is: ['/usr/local', '/usr'] BUILDING MATPLOTLIB matplotlib: 1.0.svn python: 2.5.2 (r252:60911, Jan 20 2010, 23:33:04) [GCC 4.3.2] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.1.1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/local/include', '/usr/include', '.', * '/usr/local/include/freetype2', * '/usr/include/freetype2', './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/local/include', '/usr/include', '.' Tkinter: no * TKAgg requires Tkinter wxPython: 2.8.10.1 * WxAgg extension not required for wxPython = 2.8 pkg-config: looking for pygtk-2.0 gtk+-2.0 * Package pygtk-2.0 was not found in the pkg-config * search path. Perhaps you should add the directory * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH * environment variable No package 'pygtk-2.0' found * Package gtk+-2.0 was not found in the pkg-config * search path. Perhaps you should add the directory * containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH * environment variable No package 'gtk+-2.0' found * You may need to install 'dev' package(s) to * provide header files. Gtk+: no * Could not find Gtk+ headers in any of * '/usr/local/include', '/usr/include', '.' Mac OS X native: no Qt: no Qt4: no Cairo: 1.4.12 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.4 pytz: 2008b OPTIONAL USETEX DEPENDENCIES dvipng: 1.11 ghostscript: 8.63 latex: 3.141592 pdftops: 3.00 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends
Re: [Matplotlib-users] Fwd: install from svn on Linux not working for me
On Mon, Apr 19, 2010 at 1:31 PM, Mauro Cavalcanti mauro...@gmail.com wrote: As I posted before, I ran across precisely these same errors when upgrading my Ubuntu box and the Python interpreter. You will need to install other dependencies as the installation log shows (gtk-2.0+, pygtk), including its development versions. Can someone explain why I was able to have matplotlib 0.99 installed previously, and can easily have 0.98 installed through Synaptic/Ubuntu repositories, and yet have to hunt down the additional dependencies myself if I install from svn? I can't recall if I installed 0.99 through a third party repository or how I got it, but the point is: is the svn version going to be different than what one gets through a repository? Is this need to install dependencies usually the case when installing from svn?--and if so, can I suggest that this be mentioned in the online documentation? (perhaps it is and I didn't see it?). And yes, distributing a packaged Python application which uses Matplotlib (either for Linux or Windows) is *not* an easy and simple matter. But with patience, it is possible. On Windows I've found it is close to easy once you know to include the matplotlib data files in your py2exe script (also, using GUI2Exe helps with this a great deal). What are the (basic) steps for doing this on Linux? I was thinking of using cx_freeze or something to package everything up on Linux. Thank you, Che -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: install from svn on Linux not working for me
Michael and Darren (and others), I've used svn before to download pure Python code, but never to get anything that needed to be built. I'm fairly out to sea here, so thanks for the patience. When building from source, you also need the header files (*.h files) of all of matplotlib's dependencies. When you install the matplotlib binary package (.deb file), these header files are not installed. Debian, Ubuntu and most other Linux distros separate the compiled binary libraries and header files into separate packages. The latter are usually named the same as the binary package but with a -dev suffix. That's useful to know. The apt-get build-dep command is designed specifically to install all of the header files required to build a particular package. Therefore apt-get build-dep python-matplotlib is a great shortcut to set up your machine for building matplotlib from source. I did that, and then did the setup.py install and, yes, it now all works for me (not that you don't know that). I have mpl 1.0 installed on that Ubuntu machine. (btw, Mauro, thanks for the tip on Jaunty...I've been having random crashes with Intrepid now and may try to start anew with Lucid Lynx when it comes out in a couple of weeks). Is this need to install dependencies usually the case when installing from svn?--and if so, can I suggest that this be mentioned in the online documentation? (perhaps it is and I didn't see it?). It sure can -- it was overlooked because this requirement is true of any compiled piece of software, not just matplotlib. Would you like to contribute a paragraph or two? I'd be happy to merge it into the docs. I can at least try; let me know if what follows is a good approach to take. The problem I've had today is that I didn't realize one has to build matplotlib when getting it as source AND that there are a lot of build requirements prior to installing. All that actually IS on a web page, but my problem is when I skipped to the install from svn link, I was then on a new page that didn't mention it, and, being new to building, didn't realize it. And so, my suggestion would be that at every place (1-3 places perhaps) where the docs mention doing the following: cd matplotlib python setup.py build python setup.py install (such as on the install from svn page) ...there can be a) a small note reminding newbies that in order to build you need to have the build requirements satisfied or else the build will fail with numerous errors, and in that note b) a link back to the Build requirements paragraph already on this page, here: http://matplotlib.sourceforge.net/users/installing.html ...and maybe c) the shortcut that you mentioned for Linux users. If (c) doesn't belong there, it should at least be in the Build requirements paragraph, something along the lines of this: Note: if you are building matplotlib on Linux, instead of manually installing all of the build requirements (dependencies), you can simply run this command: apt-get build-dep python-matplotlib It should take some time to finish, but you will then have built matplotlib as well as everything needed to have it work. Afterward, all you need do is install it with: cd matplotlib python setup.py install I hope this makes sense. I appreciate everyone's help here. Che -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] install from svn on Linux not working for me
My goal is to just get the lastest svn version of matplotlib, or, if not that, just the 0.99 version, up and working on my Linux (Intrepid Ibex) computer. I checked it matplotlib out from svn fine, and then, as per the webpage, did: cd matplotlib python setup.py install and that resulted in a very large amount of errors. I'll post them at the bottom of this message, since there are many lines. I previously had 0.98.x installed, via the Ubuntu repositories, but I have uninstalled it. My version is: Linux ubuntu 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008 x86_64 GNU/Linux Any help is appreciated. Thank you, Che Errors (starting from a few lines before): creating build/temp.linux-x86_64-2.5/src creating build/temp.linux-x86_64-2.5/CXX gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/lib/python2.5/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/lib/python2.5/site-packages/numpy/core/include/freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/include/python2.5 -c src/ft2font.cpp -o build/temp.linux-x86_64-2.5/src/ft2font.o cc1plus: warning: command line option -Wstrict-prototypes is valid for Ada/C/ObjC but not for C++ In file included from ./CXX/Extensions.hxx:37, from src/ft2font.h:4, from src/ft2font.cpp:1: ./CXX/WrapPython.h:58:20: error: Python.h: No such file or directory In file included from src/ft2font.cpp:1: src/ft2font.h:13:22: error: ft2build.h: No such file or directory src/ft2font.h:14:10: error: #include expects FILENAME or FILENAME src/ft2font.h:15:10: error: #include expects FILENAME or FILENAME src/ft2font.h:16:10: error: #include expects FILENAME or FILENAME src/ft2font.h:17:10: error: #include expects FILENAME or FILENAME src/ft2font.h:18:10: error: #include expects FILENAME or FILENAME In file included from /usr/lib/python2.5/site-packages/numpy/core/include/numpy/arrayobject.h:14, from src/ft2font.cpp:5: /usr/lib/python2.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:100:2: error: #error Must use Python with unicode enabled. In file included from ./CXX/Python3/Exception.hxx:45, from ./CXX/Python3/Objects.hxx:45, from ./CXX/Python3/Extensions.hxx:52, from ./CXX/Extensions.hxx:42, from src/ft2font.h:4, from src/ft2font.cpp:1: ./CXX/Python3/IndirectPythonInterface.hxx:50: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:51: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:52: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:53: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:55: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:56: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:57: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:58: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:59: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:60: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:61: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:62: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:63: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:64: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:65: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:66: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:67: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:68: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:69: error: expected constructor, destructor, or type conversion before ‘*’ token ./CXX/Python3/IndirectPythonInterface.hxx:70: error: expected constructor, destructor, or type conversion before ‘*’ token