Re: [Matplotlib-users] Corr plot in subplot
All the pandas plots that I've used take an axes keyword so try: c = corrplot.Corrplot(df, ax=ax1) or c = corrplot.Corrplot(df, axes=ax1) Do either of those work? On Fri, Mar 13, 2015 at 2:04 PM, Paul Hobson pmhob...@gmail.com wrote: What's the function signature of corrplot.CorrPlot? Hopefully you can pass an Axes object to it argument. -p On Fri, Mar 13, 2015 at 9:02 AM, Sudheer Joseph sudheer.jos...@yahoo.com wrote: Dear Matplotlib exprets, I am trying to place the corrplot in subplot environment. But not able to figure out how to do it properly. Can any one advice please? from biokit.viz import corrplot df = pd.DataFrame(dict(( (k, np.random.random(10)+ord(k)-65) for k in letters))) df = df.corr() c = corrplot.Corrplot(df) I wanted to make the corrplot in below 4 boxes which can come out as a single figure. The above data is a test data actually I wanted use seasonal data for this purpose. fig = plt.figure() fig.subplots_adjust(left=0.2, wspace=0.6) ax1 = fig.add_subplot(221) ax2 = fig.add_subplot(222) ax3 = fig.add_subplot(223) ax4 = fig.add_subplot(224) *** 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 *** -- 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 -- 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] Lorenz - solution
That's pretty swag! On Tue, Mar 10, 2015 at 11:49 AM, Benjamin Root ben.r...@ou.edu wrote: +1000!! Great job! Would you mind if I clean it up a bit and add it to the mplot3d/animation gallery? Full credit, of course. On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian prahas.mu...@gmail.com wrote: Friends, I thought you'd like to see the solution. Many thanks to Jake Vanderplas for his code and teachings: https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/ If you start a new IP Notebook session, run as your first entry: %pylab and then copy and paste the text below and run it, you should be good to go (on a Mac, at least). There are several parameters I've changed from his original, and I've commented as I've changed. The original code is at the link above. There is one error in his code -- I've documented it below. Again, thanks to the community, Jake, and Ben Root. --Prahas ** import numpy as np from scipy import integrate from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames from matplotlib import animation # orig value of N_traj was 20 -- very cool this way. N_trajectories = 1 def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): Compute the time-derivative of a Lorentz system. return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] # Choose random starting points, uniformly distributed from -15 to 15 np.random.seed(1) # changing from -15,30 to 10,5 below starts the drawing in the middle, # rather than getting the long line from below # if using N_Traj 1, return to orig values. # x0 = -15 + 30 * np.random.random((N_trajectories, 3)) x0 = 10 + 5 * np.random.random((N_trajectories, 3)) # Solve for the trajectories # orig values: 0,4,1000 # 3rd value -- lower it, it gets choppier. # 2nd value -- increase it -- more points, but speedier. # change middle num from 4 to 15 -- this adds points t = np.linspace(0, 40, 3000) x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t) for x0i in x0]) # Set up figure 3D axis for animation fig = plt.figure() ax = fig.add_axes([0, 0, 1, 1], projection='3d') # changing off to on below adds axises. slows it down but you # can fix that with interval value in the animation call ax.axis('on') # choose a different color for each trajectory colors = plt.cm.jet(np.linspace(0, 1, N_trajectories)) # set up lines and points -- this is a correction from # the orig jake code. the next four lines... lines = [ax.plot([], [], [], '-', c=c)[0] for c in colors] pts = [ax.plot([], [], [], 'o', c=c)[0] for c in colors] # prepare the axes limits ax.set_xlim((-25, 25)) ax.set_ylim((-35, 35)) ax.set_zlim((5, 55)) # set point-of-view: specified by (altitude degrees, azimuth degrees) ax.view_init(30, 0) # initialization function: plot the background of each frame def init(): for line, pt in zip(lines, pts): line.set_data([], []) line.set_3d_properties([]) pt.set_data([], []) pt.set_3d_properties([]) return lines + pts # animation function. This will be called sequentially with the frame number def animate(i): # we'll step two time-steps per frame. This leads to nice results. i = (2 * i) % x_t.shape[1] for line, pt, xi in zip(lines, pts, x_t): x, y, z = xi[:i].T line.set_data(x, y) line.set_3d_properties(z) pt.set_data(x[-1:], y[-1:]) pt.set_3d_properties(z[-1:]) # changed 0.3 to 0.05 below -- this slows the rotation of the view. # changed 30 to 20 below # changing 20 to (20 + (.1 * i)) rotates on the Z axis. trippy. ax.view_init(10, 0.1 * i) # ax.view_init(10, 100) fig.canvas.draw() return lines + pts # instantiate the animator. I've deleted the blit switch (for Mac) # enlarging frames=500 works now -- it failed before because I didn't give it # enough data -- by changing the t=np.linspace line above I generate more points. # interval larger slows it down # changed inteval from 30 to 200, frames from 500 to 3000 anim = animation.FuncAnimation(fig, animate, init_func=init, frames=3000, interval=200) # Save as mp4. This requires mplayer or ffmpeg to be installed. COMPLEX! # Instead, use a screen record program: Quicktime on the Mac; MS Expression Encoder on PC. # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec', 'libx264']) plt.show() -- 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
Re: [Matplotlib-users] Defaults?
I use a config file in ipython notebooks that sets some parameters of the ipython notebook and then sets the matplotlib defaults. http://nbviewer.ipython.org/github/hugadams/pyuvvis/blob/master/examples/Notebooks/NBCONFIG.ipynb Then I use in all subsequent analysis in the ipython notebook: http://nbviewer.ipython.org/urls/raw.github.com/hugadams/pyuvvis/master/examples/Notebooks/basic_units.ipynb On Fri, Nov 7, 2014 at 10:15 AM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, just something I was wondering about today. I commonly want to change certain things about my plots. For example I like a serif/larger fonts, and everyone knows that jet is an awful default colour map almost always... It could be neat to have some more default rc's or so that can be loaded easily. I mean I could just create one for myself, but having some examples of what can be done and being able to switch that could be neat. Such as some defaults that are better for printing, maybe in matplotlib or really just on a website which shows some example plot for uploaded RCs. Anyway, just rambling :), I am not planning to really think about it much. And maybe some things even exist and I am not aware of it. Regards, Sebastian -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 overlaid plots with grid??
I wrote a program that draws grids manually on mpl plots a while back. If you can't find a solution can you write back here and I'll try to get that dusted off? On Oct 21, 2014 2:39 PM, Benjamin Root ben.r...@ou.edu wrote: Well, the first part is easy... it is called twinx(). If you look up axis twinning in the documentation, you will find a lot of examples of this. As for the grids part... that would be tricky. I would first just see if matplotlib just does the right thing. Doubtful, but who knows? Then I would likely go the route of lining up the major ticks on both axes so that the grid lines for one axes match up with the ticks for the other. Let us know what you find out. Maybe it might be a useful feature to add for twinning. Cheers! Ben Root On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker ndbeck...@gmail.com wrote: I need to overlay 2 different plots. They will share an x-axis, but will have 2 different y axis with 2 different sets of units. I want one y-axis on left and one on right. But to make it harder, I want a grid. That means, there are either 2 different grids, which is ugly, or one plot has to be scaled vertically so that the same y grid can be shared between them. Anyone know how to do this? -- -- Those who don't understand recursion are doomed to repeat it -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Diplaying 2D images in mplot3d
Instead of learning VTK, you may find it easier to start with Mayavi 2 (written on VTK). On Wed, Oct 1, 2014 at 2:27 PM, Fabrice C. kappamonag...@yahoo.co.jp wrote: Dear Ben, Thank you for the explanation. Too bad mplot3d cannot display textured polygons. I did have a look at glumpy and it does part of what I am looking for. However, glumpy does not support being embedded in a wxpython application which is a requisite for me. I guess I just have to learn VTK... Thanks again, Fabrice Benjamin Root ben.r...@ou.edu wrote: I tried something like this awhile back to no avail. Because of the kludgy nature of mplot3d, we are lucky we even can display 2d artists like polygons (and, this is me speaking as the de facto maintainer of mplot3d!). Images are an entirely different beast, unfortunately. What *might* work is getting a pcolormesh object converted into 3d. Not pcolor (as that is an image-based object), but the QuadMesh object that gets returned by pcolormesh(). I haven't tried to convert that into a 3d equivalent, but it might be feasible. I would also check out glumpy: https://code.google.com/p/glumpy/. I could have sworn I have seen examples of glumpy treating images as texture data for surfaces. I hope this points you in a useful direction! Ben Root On Tue, Sep 30, 2014 at 5:54 PM, Fabrice C. kappamonag...@yahoo.co.jp wrote: Dear list, I would like to display a 2D image in a mplot3d axe in order to combine it with a surface3D or a bar3d plot for instance. The effect I am looking for is similar to what can be seen in the bottom XY plane of http://matplotlib.org/1.4.0/examples/mplot3d/contourf3d_demo2.html, except that I would like to have a custom image instead of the filled contours. I googled the subject and found only messages dating at best from 2010. These messages mentioned that the imshow() method did not work on a mplot3d. Indeed it does not. The only alternatives offered by the googled answer to my problem were to switch to VTK or Mayavi. For one thing, I never managed to install VTK on my PC, and I already have other matplotlib figures in my wxpython application so I would really like to stick to matplotlib. Does anyone have pointers as to how I could display a 2D image in mplot3d? Do I need to create a new artist in order to replace the non-functionning imshow? I see that patch collections work fine in mplot3D. Would it be feasible to load an image and have it displayed as a patch collection (1 patch for each pixel)? Any advice would be highly appreciated, Fabrice --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Transferring an Axes Subplot to a projection on a 3d plot
Hi, Sorry for all of these left-field questions. We are trying to develop some custom functionality for a spectroscopy program... Given a 3d surface plot, matplotlib makes it easy to add contours along the projections of the plot. http://matplotlib.org/1.3.1/mpl_toolkits/mplot3d/tutorial.html#d-plots-in-3d We were wondering if it was possible to add other things to the projections instead of contours? For example, imagine I have a standard x vs. y plot already created in a separate Axes object. Would it be possible to transfer the data from the x vs. y plot directly onto the projection of the 3d plot? We've found that sometimes it's useful to put projections on our 3d plots that aren't necessarily reflecting the 3d-dataset per-se. It would be nice if a user could generate plots 2d plots separately, and add them as projections later. I know this is a pretty special use case, so if nothing obvious comes to mind, no problem. Thanks -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Wireframe colored mesh
Hi, I'm following up on an answered stack overflow thread: http://stackoverflow.com/questions/24909256/how-to-obtain-3d-colored-surface-via-python/26026556#26026556 They show how to create a colormap for a wireframe plot. I noticed that this solution fails when the X and Y data are not the same shape. This inherently comes down to _segments3d being a 3 dimensional array when X, Y are the same dimension, but a 1D array when X,Y are different dimensions. So for example, a set of 10 curves, each with 100 points would have the dimensions: X --- 10 Y --- 100 Z 10 x 100 I've tried hacking on this all day and just can't get a solution to bypass the numpy ravels() and rolls()! Any ideas? Thanks -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Wireframe colored mesh
https://github.com/matplotlib/matplotlib/issues/3562 On Wed, Sep 24, 2014 at 6:17 PM, Adam Hughes hughesada...@gmail.com wrote: Agreed. I will do so, thanks. If you are able to figure it out, I would be super grateful. I must have spend 5 hours beating my head over this... I'll fill it out tonight. On Wed, Sep 24, 2014 at 9:07 PM, Benjamin Root ben.r...@ou.edu wrote: I always wonder why people go through such lengths to implement such features, but never bother to offer them back into the mainline code or at least suggest such a feature. Think you could make a feature request for this on github? I bet I could figure out how to integrate it into the mesh code without the need for any hacks if I spend a free moment on it. Ben Root On Wed, Sep 24, 2014 at 8:43 PM, Adam Hughes hughesada...@gmail.com wrote: Hi, I'm following up on an answered stack overflow thread: http://stackoverflow.com/questions/24909256/how-to-obtain-3d-colored-surface-via-python/26026556#26026556 They show how to create a colormap for a wireframe plot. I noticed that this solution fails when the X and Y data are not the same shape. This inherently comes down to _segments3d being a 3 dimensional array when X, Y are the same dimension, but a 1D array when X,Y are different dimensions. So for example, a set of 10 curves, each with 100 points would have the dimensions: X --- 10 Y --- 100 Z 10 x 100 I've tried hacking on this all day and just can't get a solution to bypass the numpy ravels() and rolls()! Any ideas? Thanks -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Getting the projection of an axis
Hello, Is it possible to inspect an AxesSubplot object and infer if it is using a 3d projection or not? Couldn't figure it out directly from the API. Thanks -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Wireframe with no cstrides?
Thanks benjamin. Not sure how I overlooked this! You wouldn't happen to know how to remove the cstrides while keeping the rstrides in tact? By strides, I guess I don't mean strides per-se, but the contour lines themselves that run over the surface. On Mon, Sep 22, 2014 at 9:55 AM, Benjamin Root ben.r...@ou.edu wrote: I think you can just set the linewidth to zero like in these examples: http://matplotlib.org/examples/mplot3d/surface3d_demo.html http://matplotlib.org/examples/mplot3d/surface3d_demo3.html Cheers! Ben Root On Sat, Sep 20, 2014 at 7:44 PM, Adam Hughes hughesada...@gmail.com wrote: Also, is it possible to change the stride color/opacity? Not for this plot in particular, but for surface plots, I'd rather not have dense black strides on my surface. Can't find the right keyword call through the 3d API. Sorry if I'm overlooking something obvious in the docs On Sat, Sep 20, 2014 at 7:31 PM, Adam Hughes hughesada...@gmail.com wrote: Hi, I was using wireframe to plot my spectroscopy data, and noticed if I choose a large R-stride, I somewhat unexpectedly get this really helpful evenly spaced spectral plot (attached). The only issue is that there's still the cstride connecting some of the peaks. I'd like to get rid of this, but it seems that at least one cstride is necessary. Anyone have any hacking ideas on how to get rid of this? -- Slashdot TV. Video for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Wireframe with no cstrides?
Also, is it possible to change the stride color/opacity? Not for this plot in particular, but for surface plots, I'd rather not have dense black strides on my surface. Can't find the right keyword call through the 3d API. Sorry if I'm overlooking something obvious in the docs On Sat, Sep 20, 2014 at 7:31 PM, Adam Hughes hughesada...@gmail.com wrote: Hi, I was using wireframe to plot my spectroscopy data, and noticed if I choose a large R-stride, I somewhat unexpectedly get this really helpful evenly spaced spectral plot (attached). The only issue is that there's still the cstride connecting some of the peaks. I'd like to get rid of this, but it seems that at least one cstride is necessary. Anyone have any hacking ideas on how to get rid of this? -- Slashdot TV. Video for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] removing a plot from an axes
This will clear the figure: plt.clf() Is this what you're looking for, or just to pop one plot form the stack? On Fri, Apr 18, 2014 at 6:21 PM, Michael Mossey michaelmos...@gmail.comwrote: Sorry for what is a beginnerish question but I'm having a hard time using the docs. I want to remove a previous plot from an axes. How do I do this? Incidentally, it makes the docs hard to use that there are so many methods on Axes which are spread a great distance over the page. It would be nice to have a concise listing of the methods of Axes. Note that I'm not using pyplot, but I think the term for what I'm doing is using the API. I'm subclassing FigureCanvas in PyQt, creating a Figure, and creating an axes using Figure.add_subplot(). Mike -- 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] Variable size markers legend formatting
Hi Paul, I tried out the legend proxy artist, and it works for rectangles in the legend, but I can't seem to get a Circle to appear in the legend, which I presume should be: p = Circle((0, 0), fc=r) legend([p], [Red Rectangle]) On Wed, Apr 9, 2014 at 2:20 PM, Adam Hughes hughesada...@gmail.com wrote: Thanks Paul, I will try it out. On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson pmhob...@gmail.com wrote: On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes hughesada...@gmail.comwrote: Thanks. That's probably the way I'll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there's no way that matplotlib could know which legend size I want. I wonder if there'd be any interest in a PR to add a keyword to legend to handle this situation? Why not just work the other way around with proxy artists. IOW, make the artists but never add them to the plot. http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist (works with Line2D artists) -p On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith smit...@fusion.gat.comwrote: Adam, I haven't investigated, but does the discussion of the legend marker at [1] help? -Sterling [1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html On Apr 8, 2014, at 3:44PM, Adam Hughes wrote: Hello, I've been searching but can't seem to find this topic addressed (perhaps wrong search terms) Simply put, I have a scatter plot with variable size markers, and I'd like to have the markers all be a single size in the legend. Is there a standard way to do this? Thanks. -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Variable size markers legend formatting
Thanks. That's probably the way I'll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there's no way that matplotlib could know which legend size I want. I wonder if there'd be any interest in a PR to add a keyword to legend to handle this situation? On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith smit...@fusion.gat.comwrote: Adam, I haven't investigated, but does the discussion of the legend marker at [1] help? -Sterling [1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html On Apr 8, 2014, at 3:44PM, Adam Hughes wrote: Hello, I've been searching but can't seem to find this topic addressed (perhaps wrong search terms) Simply put, I have a scatter plot with variable size markers, and I'd like to have the markers all be a single size in the legend. Is there a standard way to do this? Thanks. -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Variable size markers legend formatting
Thanks Paul, I will try it out. On Wed, Apr 9, 2014 at 12:21 PM, Paul Hobson pmhob...@gmail.com wrote: On Wed, Apr 9, 2014 at 9:00 AM, Adam Hughes hughesada...@gmail.comwrote: Thanks. That's probably the way I'll go. At first, I thought creating separate legend markers and removing them from the plot seemed hacky, but I guess there's no way that matplotlib could know which legend size I want. I wonder if there'd be any interest in a PR to add a keyword to legend to handle this situation? Why not just work the other way around with proxy artists. IOW, make the artists but never add them to the plot. http://matplotlib.org/users/legend_guide.html?highlight=proxy%20artists#using-proxy-artist (works with Line2D artists) -p On Wed, Apr 9, 2014 at 1:44 AM, Sterling Smith smit...@fusion.gat.comwrote: Adam, I haven't investigated, but does the discussion of the legend marker at [1] help? -Sterling [1] https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25200.html On Apr 8, 2014, at 3:44PM, Adam Hughes wrote: Hello, I've been searching but can't seem to find this topic addressed (perhaps wrong search terms) Simply put, I have a scatter plot with variable size markers, and I'd like to have the markers all be a single size in the legend. Is there a standard way to do this? Thanks. -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Variable size markers legend formatting
Hello, I've been searching but can't seem to find this topic addressed (perhaps wrong search terms) Simply put, I have a scatter plot with variable size markers, and I'd like to have the markers all be a single size in the legend. Is there a standard way to do this? Thanks. -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Changing figure background color (through rcparams?)
Hi, I am using an IPython notebook style that has a soft, yellow background that I think is more appealing that white. When I make a plot, I'd like the background of the plot (ie, everything that is outside the x and y axis) to be the same color. I'm trying to change the figure.facecolor parameter through rc params but I don't see any changes. Is figure.facecolor event he correct parameter? Has anyone done this successfully? -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Access to color cycle?
Hi, I am making a stacked histogram where one must enter the desired colors together in a list/array when the histogram is called. For certain objects in my code, it's helpful to assign a color to them, so that they are immediately identified across various plots. Therefore, I essentially want to take the color cycle, swap out a few entries for which colors have been assigned by the user, and otherwise keep the cycle in tact. For example, if the first object is to be orange, but no other colors are assigned, I want something like: colors= ['orange', default_cycle[1::]] However, according to some threads, the only way to access the color cycle that I'm aware of is through a generator stored in: axes._get_lines.color_cycle() I don't like this approach because iterating through the color cycle will cause the next plot to start at a different point in the cycle. I'm sure I can hack something up that gets around this, but there seems to be a canonical way to just list all of the default colors in a list once and be done with it. Is this the case? Thanks. -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Access to color cycle?
Well, the hack wasn't as messy as I thought. Still feel like there's a better way... def show_colors_default(): fig, axfoo = plt.subplots() clist = [] c = axfoo._get_lines.color_cycle.next() # Iterate until duplicate is found while c not in clist: clist.append(c) c = axfoo._get_lines.color_cycle.next() # Reset colorcycle for i in range(len(clist) -1): axfoo._get_lines.color_cycle.next() return clist On Wed, Mar 5, 2014 at 2:56 PM, Adam Hughes hughesada...@gmail.com wrote: Hi, I am making a stacked histogram where one must enter the desired colors together in a list/array when the histogram is called. For certain objects in my code, it's helpful to assign a color to them, so that they are immediately identified across various plots. Therefore, I essentially want to take the color cycle, swap out a few entries for which colors have been assigned by the user, and otherwise keep the cycle in tact. For example, if the first object is to be orange, but no other colors are assigned, I want something like: colors= ['orange', default_cycle[1::]] However, according to some threads, the only way to access the color cycle that I'm aware of is through a generator stored in: axes._get_lines.color_cycle() I don't like this approach because iterating through the color cycle will cause the next plot to start at a different point in the cycle. I'm sure I can hack something up that gets around this, but there seems to be a canonical way to just list all of the default colors in a list once and be done with it. Is this the case? Thanks. -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Access to color cycle?
Thanks Andreas. That is correct; however, I'd rather not make this change global. I only want a subset of my plots to have this behavior. I feel like changing the rcparams would change this globally and probably confuse users who don't know this is being called. I should have realized this before posting, but by putting this into a function as I've shown above, the foo plot is destroyed, so it doesn't actually appear in notebooks (which is why I was hesitant to use it in the first place). Therefore, reseting the color cycle is not necessary and this is all that is requried. def show_colors_default(): axfoo = plt.subplots()[1] c = axfoo._get_lines.color_cycle.next() # Iterate until duplicate is found while c not in clist: clist.append(c) return clist My histogram would merely access this and be done with it. On Wed, Mar 5, 2014 at 3:07 PM, Andreas Hilboll li...@hilboll.de wrote: On 05.03.2014 20:56, Adam Hughes wrote: Hi, I am making a stacked histogram where one must enter the desired colors together in a list/array when the histogram is called. For certain objects in my code, it's helpful to assign a color to them, so that they are immediately identified across various plots. Therefore, I essentially want to take the color cycle, swap out a few entries for which colors have been assigned by the user, and otherwise keep the cycle in tact. For example, if the first object is to be orange, but no other colors are assigned, I want something like: colors= ['orange', default_cycle[1::]] However, according to some threads, the only way to access the color cycle that I'm aware of is through a generator stored in: axes._get_lines.color_cycle() If I'm not mistaken, you should be able to set the appropriate rcParam, i.e., mpl.rcParams['axes.color_cycle'] = ['orange', default_cycle[1::]] Cheers, Andreas. I don't like this approach because iterating through the color cycle will cause the next plot to start at a different point in the cycle. I'm sure I can hack something up that gets around this, but there seems to be a canonical way to just list all of the default colors in a list once and be done with it. Is this the case? Thanks. -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- -- Andreas. -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Not rendering integral/sum when using latex = True
Hi, In an IPython notebook, I've changed several setting in both the notebook's style and the plotting style. I noticed that when I change the usetex option in the rcparams: *rcParams['text.usetex'] = True * Then I add an integral sign as text to a plot (either title or axis label) *plt.title($\int_0^\infty$)* The integral symbol is not rendered. Changing usetex to false results in properly rendering. Can anyone reproduce this? -- Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Not rendering integral/sum when using latex = True
Sorry, it seems that I didn't have dvipng installed correctly! On Fri, Feb 28, 2014 at 2:53 PM, Adam Hughes hughesada...@gmail.com wrote: Hi, In an IPython notebook, I've changed several setting in both the notebook's style and the plotting style. I noticed that when I change the usetex option in the rcparams: *rcParams['text.usetex'] = True * Then I add an integral sign as text to a plot (either title or axis label) *plt.title($\int_0^\infty$)* The integral symbol is not rendered. Changing usetex to false results in properly rendering. Can anyone reproduce this? -- Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colorbllind problem
I'm wondering if the matplotlib API is designed in such a way that choosing a color schema could be done at import time. I know that the entire plot style can be changed in one call (eg put plt.xkcd() at the beginning of your code), so I wander if colorblind-compatible colors could be loaded in a similar, quick way. On Mon, Feb 17, 2014 at 1:52 PM, ChaoYue chaoyue...@gmail.com wrote: Hi Gabriele, I'm afraid you have to put the numbers by yourself using the plt.text, as in an example: a = np.arange(10) b = np.tile(a,(10,1)) c = np.tile(a[:,np.newaxis],(10)) + b plot(c) for i in range(10): plt.text(5,c[i][5],str(i)) I've askd by a review to use the colorblind compatible colors when trying to submit a paper, and I find a website below: http://jfly.iam.u-tokyo.ac.jp/color/ I put some RGB numbers for some colors here if you feel like to have a try: CCC = { 'Black':np.array([0,0,0])/255., 'Orange':np.array([230,159,0])/255., 'Skyblue':np.array([85,180,233])/255., 'BluishGreen':np.array([0,158,115])/255., 'Yellow':np.array([240,228,66])/255., 'Blue':np.array([0,114,178])/255., 'Vermilion':np.array([213,94,0])/255., 'ReddishPurple':np.array([204,121,167])/255. } Cheers, Chao On Mon, Feb 17, 2014 at 7:17 PM, Gabriele Brambilla [via matplotlib] [hidden email] http://user/SendEmail.jtp?type=nodenode=42886i=0 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? thanks Gabriele -- 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 [hidden email] http://user/SendEmail.jtp?type=nodenode=42884i=0 https://lists.sourceforge.net/lists/listinfo/matplotlib-users *daltonic.png* (181K) Download Attachmenthttp://matplotlib.1069221.n5.nabble.com/attachment/42884/0/daltonic.png -- If you reply to this email, your message will be added to the discussion below: http://matplotlib.1069221.n5.nabble.com/colorbllind-problem-tp42884.html To start a new topic under matplotlib - users, email [hidden email]http://user/SendEmail.jtp?type=nodenode=42886i=1 To unsubscribe from matplotlib, click here. NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 -- View this message in context: Re: colorbllind problemhttp://matplotlib.1069221.n5.nabble.com/colorbllind-problem-tp42884p42886.html Sent from the matplotlib - users mailing list archivehttp://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.htmlat Nabble.com. -- 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 -- 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] Most generic way to wrap collections
Hi, I am working on a library for image analysis which stores particles as indexed numpy arrays and provides functionality for managing the particles beyond merely image masking or altering the arrays directly. I've already designed classes for many common shapes including Lines/Curves, Circles/Ellipses, Polygons, Multi-shapes (eg 4 circles with variable overlap). What I'd really LOVE to do would be able to generate a matplotlib.Collection instance from these objects as generally as possible. Then, I'd be able to show data as a masked image, but also get a really nice looking plot from the objects in their Collection representation. So my question really is in the implementation. First, is there a general collection object that could work with ANY shape, or am I better off matching my shape to that collection? For example: line -- LineCollection *vs.*line -- GeneralCollection circle -- CircleCollection circle --- GeneralCollection And then, is the Collections plotting API flexible enough to mix all of these types together? Or would I have to settle for only being able to plot a collection of any 1 shape type at at time? I will delve into the API further, but ascertaining this information would really help me get started. Thanks -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Most generic way to wrap collections
Sorry, quick followup. I did find the gallery example to plot multiple patches together: http://matplotlib.org/examples/api/patch_collection.html That's excellent. Now I guess my question is how best to generalize the process of turning my objects into patches. I think I will just try to keep the geometry (ie line -- mpatch.Line) unless anyone has any better suggestions. Thanks! On Tue, Jan 7, 2014 at 3:08 PM, Adam Hughes hughesada...@gmail.com wrote: Hi, I am working on a library for image analysis which stores particles as indexed numpy arrays and provides functionality for managing the particles beyond merely image masking or altering the arrays directly. I've already designed classes for many common shapes including Lines/Curves, Circles/Ellipses, Polygons, Multi-shapes (eg 4 circles with variable overlap). What I'd really LOVE to do would be able to generate a matplotlib.Collection instance from these objects as generally as possible. Then, I'd be able to show data as a masked image, but also get a really nice looking plot from the objects in their Collection representation. So my question really is in the implementation. First, is there a general collection object that could work with ANY shape, or am I better off matching my shape to that collection? For example: line -- LineCollection *vs.*line -- GeneralCollection circle -- CircleCollection circle --- GeneralCollection And then, is the Collections plotting API flexible enough to mix all of these types together? Or would I have to settle for only being able to plot a collection of any 1 shape type at at time? I will delve into the API further, but ascertaining this information would really help me get started. Thanks -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Most generic way to wrap collections
Sorry, had forgot to reply all: Thanks Joe, that's perfect. I appreciate the tip, as I would not have realized I needed a PathCollection for lines and curves. PS, do you know if it is possible to have a background image behind a plot of patches? I know it's doable for scatter, but hadn't seen an example for patch plots in general. Paul, thanks for you help as well. I'm actually pretty confident in the primitives I've chosen. I was inspired by scikit-image.draw: http://scikit-image.org/docs/dev/api/skimage.draw.html Which returns the indicies of an array, such that anytime one ones to draw the array, they merely pass by index. For example: image = np.zeroes( (256, 256) ) rr, cc = draw.circle( center=(128,128), radius=5) image[rr, cc] = (1, 0, 0) The code above would generate a red circle. My library creates primitive classes that have an rr, cc attribute, with enough metadata to hide effectively bury this representation. This can be generated a number of ways, but the classes take care of all of this, as well as other aspects. By keeping only these indicies as primitives, the shapes can be manipulated and managed outside of any representation (ie the image). What I'd like to do is build wrappers to return PatchCollections from my already storred rr, cc data (and other metadata that is stored). In this way, I'll be able to add the very nice patches from matplotlib, but retain the same api. The project is called pyparty and I'll share it pretty soon with the scikit image mailing list. If I am able to get the patches built it, would anyone mind if I share it with the matplotlib list as well? Thanks On Tue, Jan 7, 2014 at 4:10 PM, Joe Kington joferking...@gmail.com wrote: On Tue, Jan 7, 2014 at 2:29 PM, Adam Hughes hughesada...@gmail.comwrote: Sorry, quick followup. I did find the gallery example to plot multiple patches together: http://matplotlib.org/examples/api/patch_collection.html That's excellent. Now I guess my question is how best to generalize the process of turning my objects into patches. I think I will just try to keep the geometry (ie line -- mpatch.Line) unless anyone has any better suggestions. As you've already found out, it sounds like you want a PatchCollection. There is one catch, though. Your lines/curves will need to be converted to PathPatches (which is trivial), which can then have a facecolor. Because all items in a collection will have the same facecolor by default, this means that your lines will become filled polygons, unless you specify otherwise. Therefore, you'll need to do something like this: import matplotlib.pyplot as plt from matplotlib.path import Path import matplotlib.patches as mpatches from matplotlib.collections import PatchCollection # Just a simple line, but it could be a bezier curve, etc. line = Path([(-20, -20), (-10, 10), (20, 20)]) # We'll need to convert the line to a PathPatch, and we'll throw in a circle, too line = mpatches.PathPatch(line) circle = mpatches.Circle([0, 0]) # If we don't specify facecolor='none' for the line, it will be filled! col = PatchCollection([line, circle], facecolors=['none', 'red']) fig, ax = plt.subplots() ax.add_collection(col) ax.autoscale() plt.show() Alternatively, you can just put the lines/curves in a PathCollection and the patches/polygons/etc in a PatchCollection. Hope that helps! -Joe Thanks! On Tue, Jan 7, 2014 at 3:08 PM, Adam Hughes hughesada...@gmail.comwrote: Hi, I am working on a library for image analysis which stores particles as indexed numpy arrays and provides functionality for managing the particles beyond merely image masking or altering the arrays directly. I've already designed classes for many common shapes including Lines/Curves, Circles/Ellipses, Polygons, Multi-shapes (eg 4 circles with variable overlap). What I'd really LOVE to do would be able to generate a matplotlib.Collection instance from these objects as generally as possible. Then, I'd be able to show data as a masked image, but also get a really nice looking plot from the objects in their Collection representation. So my question really is in the implementation. First, is there a general collection object that could work with ANY shape, or am I better off matching my shape to that collection? For example: line -- LineCollection *vs.*line -- GeneralCollection circle -- CircleCollection circle --- GeneralCollection And then, is the Collections plotting API flexible enough to mix all of these types together? Or would I have to settle for only being able to plot a collection of any 1 shape type at at time? I will delve into the API further, but ascertaining this information would really help me get started. Thanks -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear
Re: [Matplotlib-users] installing basemap on osx 10.6
/MaximalEdgeRing.h /opt/local/include/geos/operation/overlay/MinimalEdgeRing.h /opt/local/include/geos/operation/overlay/MinimalEdgeRing.inl /opt/local/include/geos/operation/overlay/OffsetPointGenerator.h /opt/local/include/geos/operation/overlay/OverlayNodeFactory.h /opt/local/include/geos/operation/overlay/OverlayOp.h /opt/local/include/geos/operation/overlay/OverlayResultValidator.h /opt/local/include/geos/operation/overlay/PointBuilder.h /opt/local/include/geos/operation/overlay/PolygonBuilder.h /opt/local/include/geos/operation/overlay/snap/GeometrySnapper.h /opt/local/include/geos/operation/overlay/snap/LineStringSnapper.h /opt/local/include/geos/operation/overlay/snap/SnapIfNeededOverlayOp.h /opt/local/include/geos/operation/overlay/snap/SnapOverlayOp.h /opt/local/include/geos/operation/polygonize/EdgeRing.h /opt/local/include/geos/operation/polygonize/PolygonizeDirectedEdge.h /opt/local/include/geos/operation/polygonize/PolygonizeEdge.h /opt/local/include/geos/operation/polygonize/PolygonizeGraph.h /opt/local/include/geos/operation/polygonize/Polygonizer.h /opt/local/include/geos/operation/predicate/RectangleContains.h /opt/local/include/geos/operation/predicate/RectangleIntersects.h /opt/local/include/geos/operation/predicate/SegmentIntersectionTester.h /opt/local/include/geos/operation/relate/EdgeEndBuilder.h /opt/local/include/geos/operation/relate/EdgeEndBundle.h /opt/local/include/geos/operation/relate/EdgeEndBundleStar.h /opt/local/include/geos/operation/relate/RelateComputer.h /opt/local/include/geos/operation/relate/RelateNode.h /opt/local/include/geos/operation/relate/RelateNodeFactory.h /opt/local/include/geos/operation/relate/RelateNodeGraph.h /opt/local/include/geos/operation/relate/RelateOp.h /opt/local/include/geos/operation/sharedpaths/SharedPathsOp.h /opt/local/include/geos/operation/union/CascadedPolygonUnion.h /opt/local/include/geos/operation/union/CascadedUnion.h /opt/local/include/geos/operation/union/GeometryListHolder.h /opt/local/include/geos/operation/union/PointGeometryUnion.h /opt/local/include/geos/operation/union/UnaryUnionOp.h /opt/local/include/geos/operation/valid/ConnectedInteriorTester.h /opt/local/include/geos/operation/valid/ConsistentAreaTester.h /opt/local/include/geos/operation/valid/IsValidOp.h /opt/local/include/geos/operation/valid/QuadtreeNestedRingTester.h /opt/local/include/geos/operation/valid/RepeatedPointTester.h /opt/local/include/geos/operation/valid/SimpleNestedRingTester.h /opt/local/include/geos/operation/valid/SweeplineNestedRingTester.h /opt/local/include/geos/operation/valid/TopologyValidationError.h /opt/local/include/geos/planargraph.h /opt/local/include/geos/planargraph/DirectedEdge.h /opt/local/include/geos/planargraph/DirectedEdgeStar.h /opt/local/include/geos/planargraph/Edge.h /opt/local/include/geos/planargraph/GraphComponent.h /opt/local/include/geos/planargraph/Node.h /opt/local/include/geos/planargraph/NodeMap.h /opt/local/include/geos/planargraph/PlanarGraph.h /opt/local/include/geos/planargraph/Subgraph.h /opt/local/include/geos/planargraph/algorithm/ConnectedSubgraphFinder.h /opt/local/include/geos/platform.h /opt/local/include/geos/precision.h /opt/local/include/geos/precision/CommonBits.h /opt/local/include/geos/precision/CommonBitsOp.h /opt/local/include/geos/precision/CommonBitsRemover.h /opt/local/include/geos/precision/EnhancedPrecisionOp.h /opt/local/include/geos/precision/SimpleGeometryPrecisionReducer.h /opt/local/include/geos/profiler.h /opt/local/include/geos/simplify/DouglasPeuckerLineSimplifier.h /opt/local/include/geos/simplify/DouglasPeuckerSimplifier.h /opt/local/include/geos/simplify/LineSegmentIndex.h /opt/local/include/geos/simplify/TaggedLineSegment.h /opt/local/include/geos/simplify/TaggedLineString.h /opt/local/include/geos/simplify/TaggedLineStringSimplifier.h /opt/local/include/geos/simplify/TaggedLinesSimplifier.h /opt/local/include/geos/simplify/TopologyPreservingSimplifier.h /opt/local/include/geos/spatialIndex.h /opt/local/include/geos/timeval.h /opt/local/include/geos/unload.h /opt/local/include/geos/util.h /opt/local/include/geos/util/Assert.h /opt/local/include/geos/util/AssertionFailedException.h /opt/local/include/geos/util/CoordinateArrayFilter.h /opt/local/include/geos/util/GEOSException.h /opt/local/include/geos/util/GeometricShapeFactory.h /opt/local/include/geos/util/IllegalArgumentException.h /opt/local/include/geos/util/IllegalStateException.h /opt/local/include/geos/util/Machine.h /opt/local/include/geos/util/TopologyException.h /opt/local/include/geos/util/UniqueCoordinateArrayFilter.h /opt/local/include/geos/util/UnsupportedOperationException.h /opt/local/include/geos/util/math.h /opt/local/include/geos/version.h /opt/local/include/geos_c.h $ Cheers Adam
Re: [Matplotlib-users] Lots of failing tests raising KnownFailureTest
On Mon, Nov 19, 2012 at 7:44 AM, Nelle Varoquaux nelle.varoqu...@gmail.com wrote: This is not the correct way to run the tests. Then that explains it, thanks. Does the same thing happen with the following command: python -c import matplotlib; matplotlib.test() No, all tests pass (or fail when they are expected to). KnownFailure is not a default nosetest packages. Hence, we have to load it manually when running the tests. Thanks, makes sense. Cheers Adam -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Lots of failing tests raising KnownFailureTest
Hi When running the testsuite for matplotlib-1.2.0 i.e. $ nosetests -exe matplotlib I'm getting a lot of errors of the form: == ERROR: matplotlib.tests.test_dates.test_empty_date_with_year_formatter.test -- Traceback (most recent call last): File /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/case.py, line 197, in runTest self.test(*self.arg) File /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py, line 72, in test self._func() File /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py, line 47, in failer raise KnownFailureTest(msg) # An error here when running nose means that you don't have the matplotlib.testing.noseclasses:KnownFailure plugin in use. KnownFailureTest: Test known to fail -- I would expect that these known tests should fail quietly. Shouldn't they? Cheers Adam PS: I'm using python-2.7.3, nose-1.2.1 on Mac OS X 10.8.2 compiled from MacPorts. -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Missing bar when last value is 0
If I do: bar(range(3), [1,0,2]) ... then I get 2 bars of a suitable width for a 3 bar chart, with a gap in between where the middle bar would be if not equal to 0. Yet if I do: bar(range(3), [1,2,0]) ... then I get two bars of equal width. Is there a way to preserve the space for the missing bar? -- 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] Offsetting tick labels
I am trying to get alternating tick labels to move completely above and completely below the x axis. If I call: set_ha('top') ... then the number appears fully below the x axis. However, when I call: set_ha('bottom') ... then the number appears roughly vertically centered on the axis. I am aware that vertical alignment only matches text to its bounding box. Is there a way to move this bounding box? I have tried calling set_position on the text but this seems to have no effect. I would be grateful for any suggestions as to how I can move the tick labels appropriately. -- 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] Missing bar when last value is 0
Yes, that works. Many thanks. On Thu, Sep 20, 2012 at 1:12 AM, Benjamin Root ben.r...@ou.edu wrote: On Wednesday, September 19, 2012, Adam Davis wrote: If I do: bar(range(3), [1,0,2]) ... then I get 2 bars of a suitable width for a 3 bar chart, with a gap in between where the middle bar would be if not equal to 0. Yet if I do: bar(range(3), [1,2,0]) ... then I get two bars of equal width. Is there a way to preserve the space for the missing bar? This is an autoscaling issue, I think. Your best bet is to explicitly set the x limits yourself. Cheers, Ben Root -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Legend and proxy artists
On Fri, Oct 28, 2011 at 00:56, Sterling Smith smit...@fusion.gat.com wrote: Here is a working example: from pylab import figure, arange fig = figure(1) fig.clear() ax = fig.add_subplot(111) x = arange(0,1,.25) y1 = x y2 = x**2 y3 = x**3 l1 = ax.plot(x,y1,'bo-') l2 = ax.plot(x,y2,'go-') l3 = [] for xi,x1 in enumerate(x): l3.append(ax.plot(x1,y3[xi],'ro-')) print l1,l2,l3 leg = ax.legend((l1[0],l2[0],l3[0][0]),('$x$','$x^2$','$x^3$'), numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True) OK, you're example works but trying to modify my code is resulting in the same errors. But it's late so that's a job for tomorrow... Note that when l1 and l2 are printed that they are 1-element lists, and l3 is a list of 1-element lists, all of which are not the type of handles that legend is looking for. Furthermore, in your code, you are trying to embed these lists in yet another layer of list. Thanks, this is starting to make sense... If your code worked as it was with previous versions of matplotlib, then maybe someone with more knowledge could explain what changed to not allow your code to work now (it may be related to https://github.com/matplotlib/matplotlib/pull/534). It worked without issue with matplotlib-1.0.1. Cheers Adam -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Legend and proxy artists
Hi I have recently updated to Matplotlib-1.1.0 and now one of my scripts displays the following warning: UserWarning: Legend does not support [[matplotlib.lines.Line2D object at 0x1026296d0]] Use proxy artist instead. http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist The link it refers to doesn't seem to be much help, and I can't see what I need to do in order to correctly display the legend. Below is the appropriate plotting section of my script, could anyone offer suggestions as to how to correctly display the legend? # plot size, scale by golden ratio fig = pyplot.figure() fig.set_size_inches(10, 10 / ((1 + math.sqrt(5)) / 2)) date_axes = fig.add_subplot(111) # setup secondary axes value_axes = date_axes.twinx() # set plot labels date_axes.set_xlabel(Date) date_axes.set_ylabel(Time) value_axes.set_ylabel(Value) # produce plot morning_plot = date_axes.plot_date(morning[:,0], morning[:,1], 'bo-', ms=4) evening_plot = date_axes.plot_date(evening[:,0], evening[:,1], 'go-', ms=4) value_plot = [] for v in value: value_plot.append(value_axes.plot_date(w[:,0], w[:,1], 'ro-', ms=4)) # legend date_axes.legend(([morning_plot], [evening_plot], [value_plot]), (Morning, Evening, Value), numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True) # save plot fig.savefig(plot_file) Cheers Adam -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Legend and proxy artists
On Thu, Oct 27, 2011 at 12:05, Sterling Smith smit...@fusion.gat.com wrote: Your example is not complete. I don't understand the value variable that you are iterating over, or how it affects the different plots you are making. value is simply a list of different datasets to plot, read in using: value = [] for v_file in glob.glob(value_glob): value.append(numpy.atleast_2d(numpy.loadtxt(v_file, converters={0: dates.datestr2num}))) where value_glob specifies a glob pattern of files to read in. I would guess that the problem is that you have a list of tuples of handles for value_plot, instead of a list of handles. Note that each of the plot_date commands returns a length=1 tuple of lines. So you should pick out the first item of each tuple, and you probably only need the 1st item of the value_plot list, since you only give 3 labels. I'm not really following you, do you mean something like the following: # legend date_axes.legend(([morning_plot], [evening_plot], [value_plot[0]]), (Morning, Evening, Value), numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True) as that results in the same errors? Cheers Adam -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Axes frame lineweights
Is there a way to reduce the lineweight of the axes frame edge? Alternatively, is there a way to hide the edge of the frame without turning the frame off? Thanks, Adam -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Using imshow() and plot() in the same figure
I have a figure with a number of plots that analyze a source image. I wish to show the plots along side the image. Unfortunately whichever method I call last clobbers (leaves blank axes) for the previously called method. To illustrate: fig, axs = pylab.subplots(10, 4, sharex=True, sharey=True) for i in range(10): axs[i,0].plot(some_data) axs[i,1].plot(some_data) axs[i,2].plot(some_data) axs[i,3].imshow(some_image) #= The above shows only the images in the fourth column. If, however, I call imshow() first, followed by the call to plot(), then only the plot axes appear and the images disappear. Is there a way to both plot and display images in the same figure? -Adam -- 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] Using imshow() and plot() in the same figure
Eric, Thank you for the reply. Yes, eliminating sharex and sharey does solve that problem. But then my plot axes (which are scatter plots of each orthogonal view of a vector space) are not correspondingly scaled. Is there a way to: - force scaling across specified axes without using sharex/y (and without disrupting imshow)? - have subplots within subplots so that I can have the plot() calls in one set of axes within a subplot (using sharex/y) and the imshow() calls in another subplot? -Adam On Sun, Sep 4, 2011 at 10:34 PM, Eric Firing efir...@hawaii.edu wrote: On 09/04/2011 11:12 AM, Adam Davis wrote: I have a figure with a number of plots that analyze a source image. I wish to show the plots along side the image. Unfortunately whichever method I call last clobbers (leaves blank axes) for the previously called method. To illustrate: fig, axs = pylab.subplots(10, 4, sharex=True, sharey=True) for i in range(10): axs[i,0].plot(some_data) axs[i,1].plot(some_data) axs[i,2].plot(some_data) axs[i,3].imshow(some_image) #= The above shows only the images in the fourth column. If, however, I call imshow() first, followed by the call to plot(), then only the plot axes appear and the images disappear. Is there a way to both plot and display images in the same figure? I suspect the problem here is your sharex and sharey kwargs. Try leaving them out. Eric -Adam -- 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 -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Version 1.0.0 still listed on homepage
Hi On the homepage, http://matplotlib.sourceforge.net, matplotlib-1.0.0 is still being listed as the latest available version in the News sidebar. Is there any reason why 1.0.1 is not listed here? Cheers Adam -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ploting single and multiple points
Hi In one of my codes I need to plot several time series from different files, the files are of the form 20100118 10 20100119 12 20100120 14 20100121 16 20100126 18 20100221 25 20100222 25 20100227 26 20100228 30 I use something like the following to plot these: morning = numpy.loadtxt(morning_file, converters={0: dates.datestr2num}) morning_plot = date_axes.plot_date(morning[:,0], morning[:,1], 'bo-', ms=4) However sometimes these files only contain a single line and my script fails with an error: Traceback (most recent call last): File ./plot.py, line 119, in module morning_plot = date_axes.plot_date(morning[:,0], morning[:,1], 'ro-', ms=4) IndexError: invalid index Is there a way that I can plot these files regardless of whether they contain multiple or single lines? Cheers Adam -- Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ploting single and multiple points
On Sun, Jan 9, 2011 at 13:04, Benjamin Root ben.r...@ou.edu wrote: You have run into a peculiar numpy bug that I have reported several months ago. Essentially, np.loadtxt() does a squeeze() on the data right before returning it. Therefore, if there is only one line, the array returned is a 1-d array rather than your expected 2d array. You can mitigate this by using np.atleast_2d() on the returned array. This will guarantee that your 'morning' array will always be 2d. I hope that helps! It does! Thanks! Cheers Adam -- Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Cygwin Install
I found a web page in which someone has done the horrible task of figuring out how the hell you compile in Cygwin. Details below: http://innuendopoly.org/arch/matplotlib-cygwin In short, the Cygwin compile runs into TONS of errors as is, and it seems the matplotlib developers aren't really supporting it. Trying their techniques to see if it works, but so far looking good -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Cygwin and matplotlib
Could someone please kindly let me know if matplotlib is compatible with Cygwin? I installed all the necessary dependencies, yet I cannot get matplotlib to compile correctly. At the build step, this is what I get: $ python setup.py build basedirlist is: ['/usr/local', '/usr'] BUILDING MATPLOTLIB matplotlib: 1.0.0 python: 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] platform: cygwin REQUIRED DEPENDENCIES numpy: 1.4.1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/include', '.', '/usr/include/freetype2', * './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/include', '.' cygwin warning: MS-DOS style path detected: C:/Cygwin/usr/share/tcl8.4/tclConfig.sh Preferred POSIX equivalent is: /usr/share/tcl8.4/tclConfig.sh CYGWIN environment variable option nodosfilewarning turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Traceback (most recent call last): File setup.py, line 162, in module if check_for_tk() or (options['build_tkagg'] is True): File /home/Adam/installs/matplotlib-1.0.0/setupext.py, line 816, in check_for_tk explanation = add_tk_flags(module) File /home/Adam/installs/matplotlib-1.0.0/setupext.py, line 1080, in add_tk_flags result = parse_tcl_config(tcl_lib_dir, tk_lib_dir) File /home/Adam/installs/matplotlib-1.0.0/setupext.py, line 938, in parse_tcl_config tk_lib = tk_vars.get(default, TK_LIB_SPEC)[1:-1].split()[0][2:] IndexError: list index out of range -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cygwin and matplotlib
Would anyone be so kind as to show me how to modify setupext.py such that the install actually works? I'm surprised this hasn't come up already, actually, as there definitely are a lot of bugs in trying to set it up now. At the very list, it seems that ConfigParser is constructing an empty list, and the matplotlib setup hasn't caught that error. If anyone who has successfully built on Cygwin could kindly send me their modified setupext.py and also what packages they have installed, that'd be greatly appreciated. On Mon, Aug 16, 2010 at 6:25 PM, Michiel de Hoon mjldeh...@yahoo.comwrote: Matplotlib works well with Cygwin (I am using it with the gtkcairo backend), but installing it can be a hassle. You'll have to fix errors such as the ones you're seeing by modifying setup.py or setupext.py. --Michiel. --- On *Mon, 8/16/10, Adam Gustafson am...@stat.washington.edu* wrote: From: Adam Gustafson am...@stat.washington.edu Subject: [Matplotlib-users] Cygwin and matplotlib To: matplotlib-users@lists.sourceforge.net Date: Monday, August 16, 2010, 7:23 PM Could someone please kindly let me know if matplotlib is compatible with Cygwin? I installed all the necessary dependencies, yet I cannot get matplotlib to compile correctly. At the build step, this is what I get: $ python setup.py build basedirlist is: ['/usr/local', '/usr'] BUILDING MATPLOTLIB matplotlib: 1.0.0 python: 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] platform: cygwin REQUIRED DEPENDENCIES numpy: 1.4.1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/include', '.', '/usr/include/freetype2', * './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/include', '.' cygwin warning: MS-DOS style path detected: C:/Cygwin/usr/share/tcl8.4/tclConfig.sh Preferred POSIX equivalent is: /usr/share/tcl8.4/tclConfig.sh CYGWIN environment variable option nodosfilewarning turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Traceback (most recent call last): File setup.py, line 162, in module if check_for_tk() or (options['build_tkagg'] is True): File /home/Adam/installs/matplotlib-1.0.0/setupext.py, line 816, in check_for_tk explanation = add_tk_flags(module) File /home/Adam/installs/matplotlib-1.0.0/setupext.py, line 1080, in add_tk_flags result = parse_tcl_config(tcl_lib_dir, tk_lib_dir) File /home/Adam/installs/matplotlib-1.0.0/setupext.py, line 938, in parse_tcl_config tk_lib = tk_vars.get(default, TK_LIB_SPEC)[1:-1].split()[0][2:] IndexError: list index out of range -Inline Attachment Follows- -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev -Inline Attachment Follows- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.nethttp://mc/compose?to=matplotlib-us...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] cygwin compile?
Has anyone been able to successfully compile matplotlib in Cygwin? I would imagine so, so if you've been able to do it, please help! Not quite sure why I'm having so much trouble, but the errors from the build step are below. I think perhaps the python lists are empty (can't figure out what version of the libraries I have). Could someone please instruct me as to how to fix this? It'd be much appreciated. Thanks. $ python setup.py build basedirlist is: ['/usr/local', '/usr'] BUILDING MATPLOTLIB matplotlib: 1.0.0 python: 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] platform: cygwin REQUIRED DEPENDENCIES numpy: 1.4.1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/include', '.', '/usr/include/freetype2', * './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/include', '.' Traceback (most recent call last): File setup.py, line 162, in module if check_for_tk() or (options['build_tkagg'] is True): File /home/Adam/matplotlib-1.0.0/setupext.py, line 816, in check_for_tk explanation = add_tk_flags(module) File /home/Adam/matplotlib-1.0.0/setupext.py, line 1080, in add_tk_flags result = parse_tcl_config(tcl_lib_dir, tk_lib_dir) File /home/Adam/matplotlib-1.0.0/setupext.py, line 938, in parse_tcl_config tk_lib = tk_vars.get(default, TK_LIB_SPEC)[1:-1].split()[0][2:] IndexError: list index out of range -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib.test() no errors, but $nosetest matplotlib.tests - errors and failure?
Hello, I have just updated to v1.0.0 and am trying to run the test suite to make sure everything is ok. There seems to be two different suites and I am not sure which is correct/current: $python -c 'import matplotlib; matplotlib.test()' [...snipped output...] Ran 138 tests in 390.991s OK (KNOWNFAIL=2) $nosetests matplotlib.tests I get: [...snipped output] Ran 144 tests in 380.165s FAILED (errors=4, failures=1) Two of these errors are the known failures from above, and the other two are in matplotlib.tests.test_text.test_font_styles: ImageComparisonFailure: images not close: /home/adam/result_images/test_text/font_styles.png vs. /home/adam/result_images/test_text/expected-font_styles.png (RMS 23.833) ImageComparisonFailure: images not close: /home/adam/result_images/test_text/font_styles_svg.png vs. /home/adam/result_images/test_text/expected-font_styles_svg.png (RMS 12.961) The module that fails is: FAIL: matplotlib.tests.test_mlab.test_recarray_csv_roundtrip -- Traceback (most recent call last): File /usr/local/lib/python2.6/dist-packages/nose-0.11.4-py2.6.egg/nose/case.py, line 186, in runTest self.test(*self.arg) File /usr/local/lib/python2.6/dist-packages/matplotlib/tests/test_mlab.py, line 24, in test_recarray_csv_roundtrip assert np.allclose( expected['x'], actual['x'] ) AssertionError I am not sure of the importance level of these - but I wanted to ask to see if I should do anything or if they can safely be ignored. Thanks, Adam. -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac OS X 10.6 dmg install (Tim Gray)
Hi Tim, From what I gather you are trying to install everything from source the trying to install via the dmg. I did a fresh install of python, matplotlib and a number of other packages today (on 10.6) and maybe it would be helpful to see how to install from source. When installing Python, be sure to use --enable-framework. I used a /usr/local prefix though this may be somewhere else for you. $ wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tar.bz2 $ tar -jxvf Python-2.6.5.tar.bz2 $ cd Python-2.6.5 $ ./configure --prefix=/usr/local --enable-framework $ make $ make install It appears that you have already installed numpy and so you would also need the following: dateutils $ sudo wget http://labix.org/download/python-dateutil/python-dateutil-1.5.tar.gz $ sudo tar xzf python-dateutil-1.5.tar.gz $ cd python-dateutil-1.5 $ sudo /usr/local/bin/python setup.py install freetype $ http://download.savannah.gnu.org/releases-noredirect/freetype/freetype-2.3.12.tar.gz $ sudo tar xzf freetype-2.3.12.tar.gz $ cd freetype-2.3.12 $ sudo ./configure --prefix=/usr/local $ sudo make $ sudo make install libpng $ sudo wget http://sourceforge.net/projects/libpng/files/01-libpng-master/1.4.2/libpng-1.4.2.tar.gz/download $ sudo tar xzf libpng-1.4.2.tar.gz $ cd libpng-1.4.2 $ sudo ./configure --prefix=/usr/local $ sudo make $ sudo make install pkconfig $ sudo wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz $ sudo tar xzf pkg-config-0.22.tar.gz $ cd pkg-config-0.22 $ sudo ./configure --prefix=/usr/local $ sudo make $ sudo make install Finally, you should be able to install matplotlib from source using, $ sudo wget http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/matplotlib-0.99.3.tar.gz/download $ sudo tar xzf matplotlib-0.99.3.tar.gz $ cd matplotlib-0.99.3 $ sudo /usr/local/bin/python setup.py build $ sudo /usr/local/bin/python setup.py install_* *_ Hopefully this helps. -Adam Richards Duke University -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is there a way to link axes of imshow plots?
Hi all, I updated to version 99.1.1 and I'm still getting the error ValueError: argument must be box, or datalim at set_adjustable... from axes.py when I try to do ax.set_adjustable(box-forced) as you suggested. -Adam On Thu, May 27, 2010 at 3:08 PM, Adam Fraser adam.n.fra...@gmail.comwrote: Thanks very much, I'm getting ValueError: argument must be box, or datalim at set_adjustable... I'm using Matplotlib version 0.98.5.3, do I need to update? On Thu, May 27, 2010 at 2:59 PM, Jae-Joon Lee lee.j.j...@gmail.comwrote: ax1 = subplot(121) ax2 = subplot(122, sharex=ax1, sharey=ax1) ax1.set_adjustable(box-forced) ax2.set_adjustable(box-forced) arr1 = np.arange(100).reshape((10, 10)) ax1.imshow(arr1) arr2 = np.arange(100, 0, -1).reshape((10, 10)) ax2.imshow(arr2) Note the use of set_adjustable(box-forced). sharex and sharey does not get along with axes of aspect=1 adjustable=box. -JJ On Thu, May 27, 2010 at 2:10 PM, phob...@geosyntec.com wrote: Do the “sharex” and “sharey” kwargs help? http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axes http://matplotlib.sourceforge.net/examples/pylab_examples/shared_axis_demo.html -paul From: Adam Fraser [mailto:adam.n.fra...@gmail.com] Sent: Thursday, May 27, 2010 10:44 AM To: matplotlib-users Subject: [Matplotlib-users] Is there a way to link axes of imshow plots? Suppose I have a figure canvas with 3 plots... 2 are images of the same dimensions plotted with imshow, and the other is a scatterplot. I'd like to be able to link the x and y axes of the imshow plots so that when I zoom in one, the other zooms to the same coordinates, and when I pan in one, the other pans as well. I started hacking my way around this by subclassing NavigationToolbar2WxAgg (shown below)... but there are several problems here. 1) This will link the axes of all plots in a canvas since all I've done is get rid of the checks for a.in_axes() 2) This worked well for panning, but zooming caused all subplots to zoom from the same global point, rather than from the same point in each of their respective axes. Can anyone suggest a workaround? Much thanks! -Adam from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar class MyNavToolbar(NavigationToolbar): def __init__(self, canvas, cpfig): NavigationToolbar.__init__(self, canvas) # override def press_pan(self, event): 'the press mouse button in pan/zoom mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): # only difference from overridden method is that this one doesn't # check a.in_axes(event) if x is not None and y is not None and a.get_navigate(): a.start_pan(x, y, event.button) self._xypress.append((a, i)) self.canvas.mpl_disconnect(self._idDrag) self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.drag_pan) def press_zoom(self, event): 'the press mouse button in zoom to rect mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): # only difference from overridden method is that this one doesn't # check a.in_axes(event) if x is not None and y is not None and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) self.press(event) -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users
[Matplotlib-users] Is there a way to link axes of imshow plots?
Suppose I have a figure canvas with 3 plots... 2 are images of the same dimensions plotted with imshow, and the other is a scatterplot. I'd like to be able to link the x and y axes of the imshow plots so that when I zoom in one, the other zooms to the same coordinates, and when I pan in one, the other pans as well. I started hacking my way around this by subclassing NavigationToolbar2WxAgg (shown below)... but there are several problems here. 1) This will link the axes of all plots in a canvas since all I've done is get rid of the checks for a.in_axes() 2) This worked well for panning, but zooming caused all subplots to zoom from the same global point, rather than from the same point in each of their respective axes. Can anyone suggest a workaround? Much thanks! -Adam from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar class MyNavToolbar(NavigationToolbar): def __init__(self, canvas, cpfig): NavigationToolbar.__init__(self, canvas) # override def press_pan(self, event): 'the press mouse button in pan/zoom mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): *# only difference from overridden method is that this one doesn't* *# check a.in_axes(event) * if x is not None and y is not None and a.get_navigate(): a.start_pan(x, y, event.button) self._xypress.append((a, i)) self.canvas.mpl_disconnect(self._idDrag) self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.drag_pan) def press_zoom(self, event): 'the press mouse button in zoom to rect mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): *# only difference from overridden method is that this one doesn't* *# check a.in_axes(event) * if x is not None and y is not None and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) self.press(event) -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is there a way to link axes of imshow plots?
Thanks very much, I'm getting ValueError: argument must be box, or datalim at set_adjustable... I'm using Matplotlib version 0.98.5.3, do I need to update? On Thu, May 27, 2010 at 2:59 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: ax1 = subplot(121) ax2 = subplot(122, sharex=ax1, sharey=ax1) ax1.set_adjustable(box-forced) ax2.set_adjustable(box-forced) arr1 = np.arange(100).reshape((10, 10)) ax1.imshow(arr1) arr2 = np.arange(100, 0, -1).reshape((10, 10)) ax2.imshow(arr2) Note the use of set_adjustable(box-forced). sharex and sharey does not get along with axes of aspect=1 adjustable=box. -JJ On Thu, May 27, 2010 at 2:10 PM, phob...@geosyntec.com wrote: Do the “sharex” and “sharey” kwargs help? http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axes http://matplotlib.sourceforge.net/examples/pylab_examples/shared_axis_demo.html -paul From: Adam Fraser [mailto:adam.n.fra...@gmail.com] Sent: Thursday, May 27, 2010 10:44 AM To: matplotlib-users Subject: [Matplotlib-users] Is there a way to link axes of imshow plots? Suppose I have a figure canvas with 3 plots... 2 are images of the same dimensions plotted with imshow, and the other is a scatterplot. I'd like to be able to link the x and y axes of the imshow plots so that when I zoom in one, the other zooms to the same coordinates, and when I pan in one, the other pans as well. I started hacking my way around this by subclassing NavigationToolbar2WxAgg (shown below)... but there are several problems here. 1) This will link the axes of all plots in a canvas since all I've done is get rid of the checks for a.in_axes() 2) This worked well for panning, but zooming caused all subplots to zoom from the same global point, rather than from the same point in each of their respective axes. Can anyone suggest a workaround? Much thanks! -Adam from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar class MyNavToolbar(NavigationToolbar): def __init__(self, canvas, cpfig): NavigationToolbar.__init__(self, canvas) # override def press_pan(self, event): 'the press mouse button in pan/zoom mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): # only difference from overridden method is that this one doesn't # check a.in_axes(event) if x is not None and y is not None and a.get_navigate(): a.start_pan(x, y, event.button) self._xypress.append((a, i)) self.canvas.mpl_disconnect(self._idDrag) self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.drag_pan) def press_zoom(self, event): 'the press mouse button in zoom to rect mode callback' if event.button == 1: self._button_pressed=1 elif event.button == 3: self._button_pressed=3 else: self._button_pressed=None return x, y = event.x, event.y # push the current view to define home if stack is empty if self._views.empty(): self.push_current() self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): # only difference from overridden method is that this one doesn't # check a.in_axes(event) if x is not None and y is not None and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) self.press(event) -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Draggable matplotlib legend
I thought I'd share a solution to the draggable legend problem since it took me forever to assimilate all the scattered knowledge on the mailing lists... class DraggableLegend: def __init__(self, legend): self.legend = legend self.gotLegend = False legend.figure.canvas.mpl_connect('motion_notify_event', self.on_motion) legend.figure.canvas.mpl_connect('pick_event', self.on_pick) legend.figure.canvas.mpl_connect('button_release_event', self.on_release) legend.set_picker(self.my_legend_picker) def on_motion(self, evt): if self.gotLegend: dx = evt.x - self.mouse_x dy = evt.y - self.mouse_y loc_in_canvas = self.legend_x + dx, self.legend_y + dy loc_in_norm_axes = self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas) self.legend._loc = tuple(loc_in_norm_axes) self.legend.figure.canvas.draw() def my_legend_picker(self, legend, evt): return self.legend.legendPatch.contains(evt) def on_pick(self, evt): legend = self.legend if evt.artist == legend: bbox = self.legend.get_window_extent() self.mouse_x = evt.mouseevent.x self.mouse_y = evt.mouseevent.y self.legend_x = bbox.xmin self.legend_y = bbox.ymin self.gotLegend = 1 def on_release(self, event): if self.gotLegend: self.gotLegend = False #...and in your code... def draw(self): ax = self.figure.add_subplot(111) scatter = ax.scatter(np.random.randn(100), np.random.randn(100)) legend = DraggableLegend(ax.legend()) -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] tk_agg plotting error when using legend()
, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py, line 1760, in draw a.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/legend.py, line 389, in draw self._legend_box.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 240, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py, line 504, in draw c.draw(renderer) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py, line 530, in draw drawFunc(renderer, gc, tpath, affine.frozen()) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py, line 866, in _draw_lines self._lineFunc(renderer, gc, path, trans) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py, line 917, in _draw_dashed renderer.draw_path(gc, path, trans) File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py, line 117, in draw_path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number Using the following code: from pylab import * import numpy,scipy,matplotlib; h=6.626e-27 c=3e10 nu=3e18/5500. k=1.38e-16 T=6000 mynu=linspace(1e13,10**15.2,10) dnu = mean(mynu[1:]-mynu[:-1]) planck = 2*h*mynu**3/c**2 * (exp(h*mynu/(k*T))-1)**-1 mylam=linspace(1500e-8,5e-4,10) dlam = mean(mylam[1:]-mylam[:-1]) planckL=2*h*c**2/mylam**5*(exp(h*c/(mylam*k*T))-1)**-1; planckLn = planckL* planck.max()/planckL.max() figure(0); clf(); loglog(mynu,planck,label=r'$\nu$') plot(3e10/mylam,planckLn,label=r'$\lambda$') xlabel(r'$\nu$') ylabel(r'$B_\nu$') vlines(3e10/5500e-8,1e-7,1e-4) vlines(3e10/6000e-8,1e-7,1e-4,linestyle='--') vlines(3e10/5000e-8,1e-7,1e-4,linestyle='--') legend(loc='best') figure(1); clf() loglog(mynu,planck*mynu,label=r'$\nu$') plot(3e10/mylam,planckL*mylam,label=r'$\lambda$') vlines(3e10/5500e-8,1e6,2e10) vlines(3e10/6000e-8,1e6,2e10,linestyle='--') vlines(3e10/5000e-8,1e6,2e10,linestyle='--') xlabel(r'$\nu = c / \lambda$') ylabel(r'$\nu B_\nu = \lambda B_\lambda$') legend(loc='best') lamlow = 5000e-8 lamhi = 6000e-8 nulow = 3e10/lamhi nuhi = 3e10/lamlow whnu = (mynunuhi)*(mynunulow) whlam = (mylamlamhi)*(mylamlamlow) int_nu = (planck[whnu]*dnu).sum() int_lam = (planckL[whlam]*dlam).sum() print int_nu = %g % (int_nu) print int_lam = %g % (int_lam) show() The error only happens when I use a legend; i.e. there is no error when the legend() lines are commented out. I've only explored a little parameter space but it still happens without latex in the labels and when I use a linear-linear plot. Adam -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ipython threading fails with macosx backend
Trying to plot anything with any dashed pattern causes the error: Python 2.6.2 (r262:71600, Jun 20 2009, 12:18:19) Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. In [1]: from pylab import * matplotlib data path /Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/matplotlib/mpl-data loaded rc file /Users/adam/.matplotlib/matplotlibrc matplotlib version 0.98.5.3 verbose.level helpful interactive is True units is True platform is darwin $HOME=/Users/adam CONFIGDIR=/Users/adam/.matplotlib Using fontManager instance from /Users/adam/.matplotlib/fontList.cache backend MacOSX version unknown In [2]: plot([0,1],'--') Out[2]: [matplotlib.lines.Line2D object at 0x102a58490] In [3]: Thu Jul 2 20:46:44 eta.colorado.edu Python-64[33793] Error: CGContextSetLineDash: invalid dash array: negative lengths are not allowed. On Thu, Jul 2, 2009 at 8:44 PM, Michiel de Hoonmjldeh...@yahoo.com wrote: I can't draw dashed lines. In principle, you should be able to draw dashed lines with the MacOSX backend. Can you post a complete script that triggers this error? Thu Jul 2 14:51:48 Python-64[56094] Error: CGContextSetLineDash: invalid dash array: negative lengths are not allowed. --Michiel. --- On Thu, 7/2/09, keflavich keflav...@gmail.com wrote: From: keflavich keflav...@gmail.com Subject: Re: [Matplotlib-users] ipython threading fails with macosx backend To: matplotlib-users@lists.sourceforge.net Date: Thursday, July 2, 2009, 4:54 PM OK, thanks. I don't really know why it's failing, but I'm going to continue trying to get other backends installed to test them. I also now have independent reasons not to use the MacOSX backend: Thu Jul 2 14:51:48 Python-64[56094] Error: CGContextSetLineDash: invalid dash array: negative lengths are not allowed. I can't draw dashed lines. Adam -- View this message in context: http://www.nabble.com/ipython-threading-fails-with-macosx-backend-tp24311071p24313852.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplots with no space between limited to 6x6?
Thanks Jae-Joon, that worked. Adam On Mon, Jun 29, 2009 at 9:03 AM, Jae-Joon Leelee.j.j...@gmail.com wrote: Yes, I can reproduce this with the current svn. I think what's happening is that, with larger number of grid, there is slight overlapping between each subplots (likely due to the floating point error). Note that subplot command deletes existing axes if they overlap with the new one. There would be several work-arounds. You may use non-zero spacing, eg, 0.001 worked for me. Or, you may manually add subplots to the figure to avoid any deletion of existing axes. from matplotlib.axes import Subplot fig = gcf() subplots_adjust(hspace=0.,wspace=0.) for i in xrange(1,65): ax = Subplot(fig, 8, 8, i) fig.add_subplot(ax) plot( [0,1] ) Regards, -JJ On Mon, Jun 29, 2009 at 10:29 AM, keflavichkeflav...@gmail.com wrote: Hi, I'm trying to make a large grid of subplots with no spacing between. The following code fails for any grid size larger than 6x6 by skipping a row and a column. for i in xrange(1,65): subplot(8,8,i) plot( [0,1] ) subplots_adjust(hspace=0,wspace=0) Is there a way around this problem? Thanks, Adam -- View this message in context: http://www.nabble.com/subplots-with-no-space-between-limited-to-6x6--tp24255224p24255224.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: matplotlib-0.98.5.3
On Thu, May 21, 2009 at 18:06, Andrew Straw straw...@astraw.com wrote: If there's a port of uscan for MacPorts ( http://manpages.debian.net/cgi-bin/man.cgi?query=uscan ) you could simply use the debian watch file. It's contents are: version=3 http://sf.net/matplotlib/matplotlib-([0-9]+(?:\.[0-9]+)*)\.tar\.gz That directory isn't listable, so won't work with the MacPorts version check infrastructure. Cheers Adam -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: matplotlib-0.98.5.3
On Wed, May 20, 2009 at 21:25, John Hunter jdh2...@gmail.com wrote: The problem here is that I built the site docs from svn, not the last release. 0.98.6svn is the version stamp from svn. I have mixed feelings about fixing this. On the one hand, there is merit to having the site docs reflect the current stable release. On the other hand, I like pushing people onto svn HEAD, because this is where all the latest features and bugfixes are. By building the site docs from svn, viewers of the gallery and examples directories, as well as the plain-ol-docs, get a peak at what is possible from svn. If they try it and find their latest installation doesn't support it, after complaining on the mailing list they may try installing svn. And that is a plus for mpl, because we have more testers on svn HEAD and more potential developers. That makes sense, however the reason I was asking is that I am the maintainer of the MacPorts matplotlib port and I wanted to a way to check for the latest release, I had been using a regex to the check the latest version as displayed on home page but when this was updated to the svn release this broke. Also as the 0.98.5.3 release is not a specific release but a sub release of 0.98.5 I can't use the sourceforge downloads page to query this. It would be really helpful if a page was provided that listed the latest stable release that packagers could use to automatically query. Cheers Adam -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ANN: matplotlib-0.98.5.3
On Mon, May 18, 2009 at 07:56, John Hunter jdh2...@gmail.com wrote: I have uploaded the source and OSX binaries for the bugfix release of matplotlib-0.98.5.3 to http://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194 The homepage is saying that the latest release is 0.98.6svn, can this be corrected? Cheers Adam -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Interactive backends very (suprisingly?) slow for multiple subplots
On Wed, Apr 29, 2009 at 8:29 AM, John Hunter jdh2...@gmail.com wrote: On Wed, Apr 29, 2009 at 9:07 AM, keflavich keflav...@gmail.com wrote: Since there don't seem to be any forthcoming answers, I have a somewhat different question. In the matplotlib FAQ, it states that using 'show()' puts you in the GUI mainloop (http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show). However, using plot commands on the ipython command line does not shut down the command line generally. I gathered from some googling that this is because ipython starts up the matplotlib graphics in a different 'thread', but I don't understand how this is done and most of what I've seen says it is bad. most GUI mainloops are blocking, so after you start them you cannot issue more commands from an interactive shell. Either you need to run a GUI shell, or in the case of ipython run the GUI in a separate thread. One exception to this is tkinter (tkagg), which plays nicely with a standard python shell. I understand that recent versions of pygtk work also w/o running the mainloop in a separate thread, but I haven't dug into the details. OK, that's very helpful. So, my question now: How can I exit the GUI mainloop without closing the graphics windows? This question doesn't really make sense to me. Perhaps you can clearly describe your use case (what you need to do) rather than the proposed solutions. I would like to have access to the command line while simultaneously being able to interact with and/or display plots. I think this is what ipython does by default when you pass it a thread keyword (-pylab, -qt4thread, etc.). I had some trouble getting ipython to work correctly, but I think that had to do with passing the thread keyword before/after some other keywords. Part of my question that I hope makes sense: Is there a way to unblock the command line without closing the plot window when using an interactive backend? Thanks, and sorry about the misunderstandings / lack of clarity, Adam -- Register Now Save for Velocity, the Web Performance Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Interactive backends very (suprisingly?) slow for multiple subplots
On Wed, Apr 29, 2009 at 9:22 AM, John Hunter jdh2...@gmail.com wrote: On Wed, Apr 29, 2009 at 9:50 AM, Adam keflav...@gmail.com wrote: I would like to have access to the command line while simultaneously being able to interact with and/or display plots. I think this is what ipython does by default when you pass it a thread keyword (-pylab, -qt4thread, etc.). I had some trouble getting ipython to work correctly, but I think that had to do with passing the thread keyword before/after some other keywords. From your previous posts, I think you may have been be using ipython incorrectly, ie mixing ipython -pylab with the matplotlib use directive. Start with a canconical simple script, eg:: import matplotlib.pyplot as plt plt.figure(1) plt.plot([1,2,3]) plt.figure(2) plt.plot([4,5,6]) plt.show() and set your matplotlibrc to backend to TkAgg. Start ipython with:: ipython -pylab and run your test script with:: In [61]: run test.py If that works, close everything down and set your backend to QtAgg and try running it again in the same way and let us know what happens. It should just work. I'm suspecting in that as you were testing and trying a lot of things, you got yourself into a situation where multiple GUIs were competing for attention. Part of my question that I hope makes sense: Is there a way to unblock the command line without closing the plot window when using an interactive backend? Yes, that makes sense, and basically you need to either use TkAgg from a regular python shell, use ipython in pylab mode with any supported backend, or use a GUI shell. ipython also has support for embedding in GUI shells. See also http://matplotlib.sourceforge.net/users/shell.html JDH Thanks John. I think you answered my questions completely now. FWIW, I was not using matplotlib.use() with ipython, I was using it when calling 'python test.py' on the command line. My mistake with ipython was using an import command before -pylab, i.e.: ipython -i -c import pyfits,matplotlib -pylab which does not work, whereas ipython -pylab -i -c import pyfits,matplotlib does. Thanks for the help! -- Register Now Save for Velocity, the Web Performance Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Segmentation fault using imshow on large image
Yep, I'm running on a 64 bit machine. I've been dealing with larger than 4GB data files in IDL, but I'd rather use python/numpy/matplotlib if possible. Here's the gdb session. The error didn't happen in imshow, only when I specified show(); I guess that means I must have had ioff() set although I don't think that was my default choice last time I used matplotlib. milkyway /data/glimpseii $ gdb /usr/local/python/bin/python GNU gdb Red Hat Linux (6.3.0.0-1.159.el4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as x86_64-redhat-linux-gnu...Using host libthread_db library /lib64/tls/libthread_db.so.1. (gdb) run Starting program: /usr/local/python/bin/python [Thread debugging using libthread_db enabled] [New Thread 182900715072 (LWP 18039)] Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2 Type help, copyright, credits or license for more information. import matplotlib,scipy,numpy,pyfits from pylab import * f = pyfits.open('GLM_00600+_mosaic_I3.fits') imshow(f[0].data) matplotlib.image.AxesImage object at 0x2aa3f45890 show() Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 182900715072 (LWP 18039)] 0x002aa3170ab5 in _image_module::fromarray (this=Variable this is not available. ) at src/image.cpp:872 872 src/image.cpp: No such file or directory. in src/image.cpp Current language: auto; currently c++ (gdb) I've never used gdb before, so is there anything else I should be doing at this point? Thanks, Adam On Fri, Apr 24, 2009 at 7:52 AM, Michael Droettboom md...@stsci.edu wrote: On my machine (32-bit Fedora 10 with 2GB RAM), it chugs along swapping for a lng time and then fails with a Python MemoryError exception -- which is at least reasonable. I suspect you're running on a 64-bit machine and we're running into some sort of non-64-bit-clean issue. We try to be 64-bit clean, but it doesn't get verified on a regular basis, and not all of us (myself included) are running 64-bit OSes. Can you try running python inside of gdb and getting a traceback? That might provide some clues. We can estimate a little bit as to the memory requirements -- though it's hard to account for everything. Input array is (10370, 9320) x 4 = 386MB This array is always converted to doubles to convert to colors (this is probably a place ripe for opimtization) so you get also 786MB. Then this gets converted to an RGBA array for another 386MB Mike Adam Ginsburg wrote: Hi, I've been getting a segmentation fault when trying to display large images. A transcript of a sample session is below. I'm using the TkAgg backend, and I am using numpy, but otherwise I have made no modifications to the matplotlib setup. milkyway /data/glimpseii $ alias pylab alias pylab='/usr/local/adm/config/python/bin/ipython -pylab -log' milkyway /data/glimpseii $ pylab Activating auto-logging. Current session state plus future input saved. Filename : ipython_log.py Mode : rotate Output logging : False Raw input log : False Timestamping : False State : active Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import matplotlib,pyfits,numpy,scipy In [2]: scipy.__version__ Out[2]: '0.7.0' In [3]: numpy.__version__ Out[3]: '1.3.0' In [4]: matplotlib.__version__ Out[4]: '0.98.5.2' In [5]: f = pyfits.open('GLM_00600+_mosaic_I3.fits') In [6]: f[0].data.shape Out[6]: (10370, 9320) In [7]: f[0].data.dtype Out[7]: dtype('f4') In [8]: imshow(f[0].data) Segmentation fault Any ideas? Thanks, Adam -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Segmentation fault using imshow on large image
A 1x1 array reproduces the error: milkyway /data/glimpseii $ gdb /usr/local/python/bin/python GNU gdb Red Hat Linux (6.3.0.0-1.159.el4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as x86_64-redhat-linux-gnu...Using host libthread_db library /lib64/tls/libthread_db.so.1. (gdb) run Starting program: /usr/local/python/bin/python [Thread debugging using libthread_db enabled] [New Thread 182900715072 (LWP 19947)] Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2 Type help, copyright, credits or license for more information. from pylab import * x=rand(1,1) imshow(x) matplotlib.image.AxesImage object at 0x2a9f532390 show() Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 182900715072 (LWP 19947)] 0x002a9eac7ab5 in _image_module::fromarray (this=Variable this is not available. ) at src/image.cpp:872 872 src/image.cpp: No such file or directory. in src/image.cpp Current language: auto; currently c++ (gdb) Could you try and create an image using random data that is the same dimensions and datatype as the fits data you are using htat replicates the segfault, so we can try and reproduce the error as well as add it to our test suite? Thanks JDH -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Segmentation fault using imshow on large image
Hi, I've been getting a segmentation fault when trying to display large images. A transcript of a sample session is below. I'm using the TkAgg backend, and I am using numpy, but otherwise I have made no modifications to the matplotlib setup. milkyway /data/glimpseii $ alias pylab alias pylab='/usr/local/adm/config/python/bin/ipython -pylab -log' milkyway /data/glimpseii $ pylab Activating auto-logging. Current session state plus future input saved. Filename : ipython_log.py Mode : rotate Output logging : False Raw input log : False Timestamping : False State : active Python 2.5 (r25:51908, Dec 22 2006, 16:08:43) Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import matplotlib,pyfits,numpy,scipy In [2]: scipy.__version__ Out[2]: '0.7.0' In [3]: numpy.__version__ Out[3]: '1.3.0' In [4]: matplotlib.__version__ Out[4]: '0.98.5.2' In [5]: f = pyfits.open('GLM_00600+_mosaic_I3.fits') In [6]: f[0].data.shape Out[6]: (10370, 9320) In [7]: f[0].data.dtype Out[7]: dtype('f4') In [8]: imshow(f[0].data) Segmentation fault Any ideas? Thanks, Adam -- Crystal Reports #45; New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty#45;free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6 installer for Windows?
On Sun, Feb 22, 2009 at 16:59, Wai Yip Tung tungwai...@yahoo.com wrote: I find that Matplotlib only have Python 2.5 build for Windows. Is there any plan to release a 2.6 build soon? I am trying to build it from source but I run into numerous problem. I am still struggling to find all dependent packages. It will help a lot if the 2.6 installer is available. AFAIK matplolib doesn't support python-2.6 yet, as NumPy doesn't. NumPy is expected to get python-2.6 support in the 1.3 release, so I imagine matplotlib will support python-2.6 in a release following the NumPy-1.3 release. Cheers Adam -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Backtrace with CocoaAgg backend
Anyone? Cheers Adam On Sat, Jan 17, 2009 at 17:19, Adam Mercer ramer...@gmail.com wrote: Hi I'm trying to track down an issue with the CocoaAgg backend on Mac OS X using MacPorts, when run with the CocoaAgg backend the following code: from pylab import * import time ion() tstart = time.time() x = arange(0,2*pi,0.01) line, = plot(x,sin(x)) for i in arange(1,200): line.set_ydata(sin(x+i/10.0)) draw() print 'FPS:' , 200/(time.time()-tstart) fails with the backtrace: $ python temp.py -dCocoaAgg Traceback (most recent call last): File temp.py, line 2, in module from pylab import * File /opt/local/lib/python2.5/site-packages/pylab.py, line 1, in module from matplotlib.pylab import * File /opt/local/lib/python2.5/site-packages/matplotlib/pylab.py, line 253, in module from matplotlib.pyplot import * File /opt/local/lib/python2.5/site-packages/matplotlib/pyplot.py, line 75, in module new_figure_manager, draw_if_interactive, show = pylab_setup() File /opt/local/lib/python2.5/site-packages/matplotlib/backends/__init__.py, line 25, in pylab_setup globals(),locals(),[backend_name]) File /opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py, line 54, in module class FigureCanvasCocoaAgg(FigureCanvasAgg): File /opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py, line 63, in FigureCanvasCocoaAgg start_event_loop.__doc__=FigureCanvasBase.start_event_loop_default.__doc__ NameError: name 'FigureCanvasBase' is not defined However this runs without issue using the MacOSX backend: $ python temp.py -dMacOSX FPS: 20.1183278689 Is there some missing dependency that could cause this? Cheers Adam -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Backtrace with CocoaAgg backend
On Wed, Jan 21, 2009 at 21:09, John Hunter jdh2...@gmail.com wrote: This looks like a simple bug in which FigureCanvasBase is not imported. Try replacing line 31 in matplotlib/backends/backend_cocoaagg.py with this:: from matplotlib.backend_bases import FigureManagerBase, FigureCanvasBase I've fixed the bug on the svn branch and trunk. Thanks, that fixes the backtrace. In a somewhat unrelated note, this style of pylab animation is no longer encouraged or supported (and your example does not work with cocoaagg, even with the fix, on my osx box). Rather, you should use the GUI timeout or idle loop for your backend to support animation, as in the examples in http://matplotlib.sourceforge.net/examples/animation/index.html. While there are no cocoa specific examples (feel free to contribute one) the pattern should be fairly clear across the UIs we have examples for. Thanks, I'll pass that onto the user who reported this problem to me. Cheers Adam -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Backtrace with CocoaAgg backend
Hi I'm trying to track down an issue with the CocoaAgg backend on Mac OS X using MacPorts, when run with the CocoaAgg backend the following code: from pylab import * import time ion() tstart = time.time() x = arange(0,2*pi,0.01) line, = plot(x,sin(x)) for i in arange(1,200): line.set_ydata(sin(x+i/10.0)) draw() print 'FPS:' , 200/(time.time()-tstart) fails with the backtrace: $ python temp.py -dCocoaAgg Traceback (most recent call last): File temp.py, line 2, in module from pylab import * File /opt/local/lib/python2.5/site-packages/pylab.py, line 1, in module from matplotlib.pylab import * File /opt/local/lib/python2.5/site-packages/matplotlib/pylab.py, line 253, in module from matplotlib.pyplot import * File /opt/local/lib/python2.5/site-packages/matplotlib/pyplot.py, line 75, in module new_figure_manager, draw_if_interactive, show = pylab_setup() File /opt/local/lib/python2.5/site-packages/matplotlib/backends/__init__.py, line 25, in pylab_setup globals(),locals(),[backend_name]) File /opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py, line 54, in module class FigureCanvasCocoaAgg(FigureCanvasAgg): File /opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py, line 63, in FigureCanvasCocoaAgg start_event_loop.__doc__=FigureCanvasBase.start_event_loop_default.__doc__ NameError: name 'FigureCanvasBase' is not defined However this runs without issue using the MacOSX backend: $ python temp.py -dMacOSX FPS: 20.1183278689 Is there some missing dependency that could cause this? Cheers Adam -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Backtrace when including a legend with 0.98.5.1
Hi I've noticed that one of my codes is failing with the following backtrace since updating to 0.98.5.1: Traceback (most recent call last): File ./plot_data.py, line 153, in module fig.savefig(plot_file) File /opt/local/lib/python2.5/site-packages/matplotlib/figure.py, line 990, in savefig self.canvas.print_figure(*args, **kwargs) File /opt/local/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1419, in print_figure **kwargs) File /opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py, line 323, in print_png FigureCanvasAgg.draw(self) File /opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py, line 279, in draw self.figure.draw(self.renderer) File /opt/local/lib/python2.5/site-packages/matplotlib/figure.py, line 772, in draw for a in self.axes: a.draw(renderer) File /opt/local/lib/python2.5/site-packages/matplotlib/axes.py, line 1601, in draw a.draw(renderer) File /opt/local/lib/python2.5/site-packages/matplotlib/legend.py, line 347, in draw bbox = self._legend_box.get_window_extent(renderer) File /opt/local/lib/python2.5/site-packages/matplotlib/offsetbox.py, line 198, in get_window_extent px, py = self.get_offset(w, h, xd, yd) File /opt/local/lib/python2.5/site-packages/matplotlib/offsetbox.py, line 157, in get_offset return self._offset(width, height, xdescent, ydescent) File /opt/local/lib/python2.5/site-packages/matplotlib/legend.py, line 299, in _findoffset_best ox, oy = self._find_best_position(width, height) File /opt/local/lib/python2.5/site-packages/matplotlib/legend.py, line 699, in _find_best_position consider = [self._get_anchored_bbox(x, bbox, self.parent.bbox) for x in range(1, len(self.codes))] TypeError: _get_anchored_bbox() takes exactly 5 arguments (4 given) make: *** [data.png] Error 1 I can't remember seeing this with 0.98.5. This is clearly related to the legend as if I remove the code that sets the legend: x_axes.legend(([x1_plot], [x1_plot]), (Duration, Amount), numpoints=1, loc=0, borderpad=2, shadow=True) then the plot is produced as expected. Is this a regression, or am I doing something odd with the legend? Cheers Adam -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Backtrace when including a legend with 0.98.5.1
On Fri, Dec 26, 2008 at 13:54, John Hunter jdh2...@gmail.com wrote: Could you please post a complete, free-standing example? Also, you might want to test against 98.5.2 which has been released with some legend fixes. Thanks John, updating to 0.98.5.2 fixes the problem. Cheers Adam -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] using ginput with images -- axes are resized?
hi, I am trying to use ginput with some images and for some reason it keeps changing the axes with the mouse click. I don't know if this is a feature or bug, but I would like it not to affect my images at all. here is a short example: #--- from pylab import ginput, imshow, rand t=rand(50,50) imshow(t) x = ginput(1) #--- this problem was also addressed in a post back in august: http://www.nabble.com/ginput-changes-axes-limits-td18863282.html#a18863282 but it received no replies. any ideas on whats going on? thanks, adam. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Event handling, API programming
On Wed, Oct 29, 2008 at 11:19 PM, Anthony Floyd [EMAIL PROTECTED] wrote: Hi Adam, On Sun, Oct 26, 2008 at 4:34 PM, Adam [EMAIL PROTECTED] wrote: Hi, I'm trying to make myself a set of widgets for the first time. I've gotten to the point that I can draw rectangles and lines and make them do the right things when re-drawing figures, zooming, etc., but I'm still a little lost on some points, and I haven't found any really good documentation. So, first question: Where should I go for documentation first? As you've probably noticed, the documentation is in the middle of an update. Part of what has suffered while the docs are updated is the API documentation. The source code, however, is quite well documented. A good way to get access to this documentation is to get a hold of epydoc and run it on the matplotlib source tree. This will generate good local docs for you. Thanks, I was unaware of epydoc. The new matplotlib page (which wasn't up when I asked this question) has a lot of examples showing exactly what I want to do, so that will probably help a lot too. Adam - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Event handling, API programming
Hi, I'm trying to make myself a set of widgets for the first time. I've gotten to the point that I can draw rectangles and lines and make them do the right things when re-drawing figures, zooming, etc., but I'm still a little lost on some points, and I haven't found any really good documentation. So, first question: Where should I go for documentation first? I've been using examples, e.g. widgets.py, and the pygtk event handling page, http://www.pygtk.org/pygtk2tutorial/sec-EventHandling.html. This page was a useful explanation of the stuff in widgets.py: http://www.nabble.com/some-API-documentation-td16204232.html. Second question: I have two subplots of different data with the same dimensions. I'd like to zoom in to the same region on both figures when I use zoom-to-box on either one. How can I do this? (I'm using tkAgg) Thanks, Adam - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] MatPlotLib won't plot
Just installed matplotlib, it doesn't plot the basic plot.py: from pylab import * plot([1,2,3]) show() Here's the results: C:\Projects\Pythonpython simple-plot.py --verbose-helpful $HOME=X:\ CONFIGDIR=X:\.matplotlib matplotlib data path C:\Python25\lib\site-packages\matplotlib\mpl-data loaded rc file C:\Python25\lib\site-packages\matplotlib\mpl-data\matplotlibrc matplotlib version 0.98.3 verbose.level helpful interactive is False units is False platform is win32 I also get a popup window with this text: This application has failed to start because MSVCP71.dll was not found. Re-installing the application may fix this problem. As far as I can tell, this is a Visual C++ library from .NET 2003. My laptop is running Windows 2008 (64-bit) with the .NET 3.0 framework. I have already removed site-packages/matplotlib and reinstalled, with the same results. Let me know if I should be reporting anything else not listed on: http://matplotlib.sourceforge.net/faq.html Thanks! Adam -- Invincibility is in oneself, vulnerability in the opponent. -- Sun Tzu - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MatPlotLib won't plot
On Sun, Aug 10, 2008 at 7:29 AM, Charlie Moad Can you search your system and see if you have that dll installed somewhere. Most likely you will. If you find it, go to the command prompt and change to the directory where the dll is. Then run this command: Regsvr32 msvcp71.dll Thanks for the suggestion. I didn't have msvcp71.dll on my system, so I went here to download it: http://www.driverskit.com/dll/msvcp71.dll/2371.html Once I placed it in the python directory, C:\Python25 (next to the msvcr71.dll), it worked fine. Perhaps the matplotlib installer for 64-bit Vista/Windows 2008 (if there ever is one) should include this file (or check for it)? Thanks again for the help! - Charlie Adam -- Invincibility is in oneself, vulnerability in the opponent. -- Sun Tzu - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 0.98.2 release?
Hi Has matplotlib-0.98.2 been officially released? The reason I'm asking is that the web page still states that 0.98.1 is the release and the 0.98.2 tar ball is under the 0.98.1 release on the sourceforge download page? Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ValueError: oridinal must be = 1 with 0.98.1 - non with 0.98.0
On Wed, Jun 25, 2008 at 8:44 AM, John Hunter [EMAIL PROTECTED] wrote: I think I have this fixed in svn Just downloaded 0.98.2 and the code that failed in 0.98.1 works! Thanks! Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Linking non framework Tcl/Tk on Mac OS X
On Fri, Jun 27, 2008 at 12:03 PM, Charlie Moad [EMAIL PROTECTED] wrote: You'll need to edit setupext.py to not inject the -framework Tcl -framework Tk flags. Thanks Charlie, that does the trick. Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Linking non framework Tcl/Tk on Mac OS X
Hi I'm trying to track down a problem present in MacPorts Matplotlib build and the TkAgg backend. It appears that Matplotlib is linking against the system Tcl/Tk in /System/Library/Frameworks and not the non-framework Tcl/Tk installed by MacPorts, as to be expected this is causing segfaults when trying to use the TkAgg backend as the system version of Tcl/Tk differs from the MacPorts version. I've tried removing the list of directories to search for the framework in setupext.py in the add_tk_flags() method, ie I've set framework_dirs = [], and then set the paths to the Tcl/Tk header and libraries in the hardcoded_tcl_config() method to point to the MacPorts versions but this just leads to the build not being able to find Tcl/Tk and therefore not building the TkAgg backend, the following is displayed on build: Tkinter: no * Tkinter present, but header files are not found. * You may need to install development packages. The header files are installed. Can Matplotlib be linked against a non-framework build of Tcl/Tk on Mac OS X, and if so how? Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ValueError: oridinal must be = 1 with 0.98.1 - non with 0.98.0
I think I have this fixed in svn -- also, I rewrote your example to use csv2rec (which returns record arrays). Thought you might be interested: import matplotlib.mlab as mlab import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.cbook as cbook r1 = mlab.csv2rec('test1.dat', names='date,value', delimiter=' ', converterd={'date':cbook.todate('%Y%m%d')}) r2 = mlab.csv2rec('test2.dat', names='date,value', delimiter=' ', converterd={'date':cbook.todate('%Y%m%d')}) print 'dtype', r1.dtype fig = plt.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() # produce plot line1, = ax1.plot(r1.date, r1.value, 'bo-') line2, = ax2.plot(r2.date, r2.value, 'bo-') # set up axes ax1.xaxis.set_major_locator(mdates.DayLocator(range(0, 31, 2))) ax1.xaxis.set_minor_locator(mdates.DayLocator(range(0, 31, 1))) ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y/%m/%d')) plt.show() Thanks John, although the scale on the x-axis isn't shown using the above example. Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ValueError: oridinal must be = 1 with 0.98.1 - non with 0.98.0
On Tue, Jun 24, 2008 at 6:14 AM, Darren Dale [EMAIL PROTECTED] wrote: Please, include a brief standalone script that demonstrates the problem when reporting problems. Sorry should have done that, I've attached an example script (and the according data files) which exhibits the problem on 0.98.1, 0.98.0 has no problems. File ./test.py, line 46, in module test_plot = test_axes.plot_date(test_dates, test, 'bo-') File /opt/local/lib/python2.5/site-packages/matplotlib/axes.py, line 3081, in plot_date self.xaxis_date(tz) File /opt/local/lib/python2.5/site-packages/matplotlib/axes.py, line 2015, in xaxis_date locator.refresh() File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 540, in refresh dmin, dmax = self.viewlim_to_dt() File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 436, in viewlim_to_dt return num2date(vmin, self.tz), num2date(vmax, self.tz) File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 233, in num2date if not cbook.iterable(x): return _from_ordinalf(x, tz) File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 156, in _from_ordinalf dt = datetime.datetime.fromordinal(ix) ValueError: ordinal must be = 1 What's strange is that if I comment out the plotting of the second test data set then the plot is produced without error, even though the reported error (when plotting both data sets) seems to have nothing to do with the second data set. Cheers Adam #!/usr/bin/env python # import required system modules import sys import math from datetime import * # import required matplotlib modules import matplotlib # set backend matplotlib.use('Agg') # import remaining matplotlib modules import pylab from matplotlib import dates test_dates = [] test = [] for line in file('test1.dat'): # parse line date, num = line.strip().split() # append to lists test_dates.append(dates.datestr2num(date)) test.append(float(num)) test2_dates = [] test2 = [] for line in file('test2.dat'): # parse line date, num = line.strip().split() # append to lists test2_dates.append(dates.datestr2num(date)) test2.append(float(num)) # setup plot fig = pylab.figure() test_axes = fig.add_subplot(111) # setup secondary axes test2_axes = pylab.twinx() # produce plot test_plot = test_axes.plot_date(test_dates, test, 'bo-') test2_plot = test2_axes.plot_date(test2_dates, test2, 'ro-') # set up axes test_axes.xaxis.set_major_locator(pylab.DayLocator(range(0, 31, 2))) test_axes.xaxis.set_minor_locator(pylab.DayLocator(range(0, 31, 1))) test_axes.xaxis.set_major_formatter(pylab.DateFormatter('%Y/%m/%d')) # save plot fig.savefig('test.png') # exit cleanly sys.exit(0) test1.dat Description: Binary data test2.dat Description: Binary data - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tick_left() and tick_right() with minor tick marks
Hi Anyone know how to fix this problem? Cheers Adam On Thu, Jun 19, 2008 at 8:31 PM, Adam Mercer [EMAIL PROTECTED] wrote: Hi I have a plot that has two different y-axis scales and I want appropriate tick marks for the different y-axes. ie I want the tick marks on the left axis to correspond to the scale on the left axis etc... As far as I can tell the way to accomplish this, after consulting the documentation, is to use the tick_left() and tick_right() methods, I therefore have the following code: axes1.yaxis.tick_left() axes1.yaxis.set_major_locator(pylab.MultipleLocator(0.1)) axes1.yaxis.set_minor_locator(pylab.MultipleLocator(0.05)) axes2.yaxis.tick_right() axes2.yaxis.set_major_locator(pylab.MultipleLocator(5)) axes2.yaxis.set_minor_locator(pylab.MultipleLocator(1)) but the minor ticks are on both the left and right y-axes. How can I make the minor ticks for axes1 only appear on the the left and the minor ticks for axes2 appear on the right? Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ValueError: oridinal must be = 1 with 0.98.1 - non with 0.98.0
Hi Just upgraded to matplotlib-0.98.1, and a code that worked with 0.98.0 is now failing with the following error: Traceback (most recent call last): File ./plot_workout.py, line 126, in module time_plot = time_axes.plot_date(times_dates, times, 'bo-') File /opt/local/lib/python2.5/site-packages/matplotlib/axes.py, line 3081, in plot_date self.xaxis_date(tz) File /opt/local/lib/python2.5/site-packages/matplotlib/axes.py, line 2015, in xaxis_date locator.refresh() File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 540, in refresh dmin, dmax = self.viewlim_to_dt() File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 436, in viewlim_to_dt return num2date(vmin, self.tz), num2date(vmax, self.tz) File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 233, in num2date if not cbook.iterable(x): return _from_ordinalf(x, tz) File /opt/local/lib/python2.5/site-packages/matplotlib/dates.py, line 156, in _from_ordinalf dt = datetime.datetime.fromordinal(ix) ValueError: ordinal must be = 1 Any ideas? Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Producing a plot that contains two different y-axis scales
Hi I'm trying to produce a single plot containing two different datasets that share the same x-axis but different y-axes, i.e. I would like one y-axis to be on the left of the plot and the other on the right hand side. I've looked for example that illustrates how to do this but have been unable to find an example. Can anyone point me to and example or the appropriate methods that would allow me to do this? Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] tick_left() and tick_right() with minor tick marks
Hi I have a plot that has two different y-axis scales and I want appropriate tick marks for the different y-axes. ie I want the tick marks on the left axis to correspond to the scale on the left axis etc... As far as I can tell the way to accomplish this, after consulting the documentation, is to use the tick_left() and tick_right() methods, I therefore have the following code: axes1.yaxis.tick_left() axes1.yaxis.set_major_locator(pylab.MultipleLocator(0.1)) axes1.yaxis.set_minor_locator(pylab.MultipleLocator(0.05)) axes2.yaxis.tick_right() axes2.yaxis.set_major_locator(pylab.MultipleLocator(5)) axes2.yaxis.set_minor_locator(pylab.MultipleLocator(1)) but the minor ticks are on both the left and right y-axes. How can I make the minor ticks for axes1 only appear on the the left and the minor ticks for axes2 appear on the right? Cheers Adam - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Returning contour points as an array
Hi, I'm trying to use the values of a contour plot to evaluate the min/max along a given axis in order to marginalize a 2d distribution. This effectively amounts to doing the same thing asked for in this post: http://sourceforge.net/mailarchive/message.php?msg_id=47505681.8030306%40hawaii.edu I think there's an easier way to do this: val = contour(xRange,yRange,delchi2,[1]) t = asarray(val.collections[0].get_verts()) because the example given in the above post actually return a list, not a numpy array (unless I did it wrong). However, even though the above works, it was poorly documented and took about an hour of googling / guess-and-checking to get to it. Either the documentation should be improved a little (e.g. explain what collections really means) or some more transparent means of returning the contour data should be available. So, the question: is there any easier way to do the above? Is this actually the easy method? Thanks, Adam - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] GEOS 3 and basemap
Hi Will basemap work with the newly released GEOS-3.0.0, or does it only work with 2.2.3 for now? Cheers Adam - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] GEOS 3 and basemap
On Dec 23, 2007 7:40 PM, Jeff Whitaker [EMAIL PROTECTED] wrote: Adam: It only works with 2.2.3. I have not been able to make it work with 3.0.0, so I don't know if it ever will. Thanks for the clarification Jeff Cheers Adam - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error producing a plot after updating to 0.91.1
On Dec 7, 2007 9:09 AM, Michael Droettboom [EMAIL PROTECTED] wrote: You could try setting your backend to simply Agg to rule out some Tk usage/installation problem as the culprit. Thanks, the problem goes away if I use the Agg backend. Cheers Adam - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error producing a plot after updating to 0.91.1
On Dec 7, 2007 8:21 AM, Michael Droettboom [EMAIL PROTECTED] wrote: Can you also please attach your data -- or point to some acceptable data online? What platform and backend are you using? I've attached an example data file. I'm using the TKAgg backend on Mac OS X Leopard. Cheers Adam data.dat Description: Binary data - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Error producing a plot after updating to 0.91.1
Hi Since updating to 0.91.1 one of my scripts, attached, has stopped working. I get the following error when trying to run it $ ./plot.py data.dat plot.png alloc: invalid block: 0x1c15fa4: 40 1 0 Abort trap $ Any ideas what could be causing this? Cheers Adam plot.py Description: Binary data - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Error on importing basemap 0.9.8
Hi After updating to basemap-0.9.8 I'm getting the following error when trying to import the basemap module on Intel Mac OS X Leopard using Python-2.5.1 from MacPorts Python 2.5.1 (r251:54863, Nov 22 2007, 18:02:58) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type help, copyright, credits or license for more information. from matplotlib.toolkits import basemap Traceback (most recent call last): File stdin, line 1, in module File /opt/local/lib/python2.5/site-packages/matplotlib/toolkits/basemap/__init__.py, line 1, in module from basemap import __doc__, __version__ File /opt/local/lib/python2.5/site-packages/matplotlib/toolkits/basemap/basemap.py, line 31, in module import _geos, pupynere File /opt/local/lib/python2.5/site-packages/matplotlib/toolkits/basemap/pupynere.py, line 36, in module from dap.client import open as open_remote File /opt/local/lib/python2.5/site-packages/dap/__init__.py, line 12, in module __import__('pkg_resources').declare_namespace(__name__) ImportError: No module named pkg_resources Am I missing a required module? Cheers Adam - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error on importing basemap 0.9.8
On Dec 5, 2007 10:30 PM, John Hunter [EMAIL PROTECTED] wrote: Looks like you need setuptools http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install Thanks John, installing setuptools did the trick. Cheers Adam - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pls unsubscribe me
On 04/12/2007, pranal shah [EMAIL PROTECTED] wrote: matplot lib users... pls unsubscribe me Visit the list page thats append to every mail to this list. Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Cheers Adam - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting size of plot produced by Basemap
On 13/10/2007, Jeff Whitaker [EMAIL PROTECTED] wrote: Adam: Same as with any other plot created with matplotlib. You can use the 'figsize' keyword to pylab.figure in conjunction with the 'dpi' keyword to pylab.savefig. For details see Thanks, I was unsure whether or not is used the same system. Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Adding a colour bar to a basemap plot
On 13/10/2007, Jeff Whitaker [EMAIL PROTECTED] wrote: Adam: See the basemap examples directory - there's plenty of examples there using pylab.colorbar. Thanks, that was what I was after - the appropriate module and method. Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap projection issue
On 11/10/2007, Jeff Whitaker [EMAIL PROTECTED] wrote: Adam: I assume your data is on a latitude-longitude grid? You've asked for a mollweide projection centered on the Greenwich meridian. Your data is not centered on Greenwich - but the error message is trying to say that you can shift your grid (with the shiftgrid function) so that is has the same orientation as the map projection region. This only comes into play with global projections that 'wrap-around' at the edges, like the mollweide and mercator projections. The orthographic projection does not 'wrap around' - hence you don't get the error message. Thanks, that makes sense now. Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap projection issue
On 11/10/2007, Jeff Whitaker [EMAIL PROTECTED] wrote: Adam: I assume your data is on a latitude-longitude grid? You've asked for a mollweide projection centered on the Greenwich meridian. Your data is not centered on Greenwich - but the error message is trying to say that you can shift your grid (with the shiftgrid function) so that is has the same orientation as the map projection region. This only comes into play with global projections that 'wrap-around' at the edges, like the mollweide and mercator projections. The orthographic projection does not 'wrap around' - hence you don't get the error message. Looking at the shiftmap function it looks like I should shift the co-ordinate grid so that my longitude runs from -180 to 180 instead of 0 to 360, therefore the following shiftgrid call should do this values, lon = basemap.shiftgrid(180, values, lon) However I still get the same error and the corruption in the resulting plot. I feel like I'm missing something obvious here but can't find it. Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap projection issue
On 11/10/2007, Jeff Whitaker [EMAIL PROTECTED] wrote: but I think you want values, lon = basemap.shiftgrid(180, values, lon, start=False) Thats it! Thanks a lot! Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap with origin within the plot
On 10/10/2007, Pascoe, S (Stephen) [EMAIL PROTECTED] wrote: Is there a general way of setting the origin somewhere other than the lower-left corner? I've just had to deal with a similar problem, you need to use the basemap.shiftgrid() method to shift the co-ordinate grid accordingly. Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting 3D skymap surfaces
On 09/10/2007, Jeff Whitaker [EMAIL PROTECTED] wrote: Adam: If you can convert your coordinates into latitudes and longitudes, then you can plot the data with the basemap tookit on your choice of map projection (see http://www.scipy.org/Cookbook/Matplotlib/Maps for an example). Following that example I'm running into a few problems, this is the code I have: map = Basemap(projection='ortho',lat_0=50,lon_0=-100,resolution='l',area_thresh=1000.) map.drawmeridians(pylab.arange(0,360,30)) map.drawparallels(pylab.arange(-90,90,30)) map.contour(lat, lon, values) where lat is an array of the latitude, lon the corresponding latitude and values the value of the quantity I want to plot, this results in the error: Traceback (most recent call last): File ./plot_skymap.py, line 54, in ? map.contour(lat, lon, values) File /opt/local/lib/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py, line 2484, in contour xx = x[x.shape[0]/2,:] IndexError: too many indices Can anyone give me any pointers, on what the problem is here? Cheers Adam - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plotting data against date in ISO format
Hi I need to produce a line plot of some data against the date in ISO format, i.e. the data is something like: 20060412 546 20060413 547 20060414 657 20060415 438 ... I've been looking at the examples and can't find anything appropriate. As far as I can tell from the documentation I need to read in the date and use date2num to convert the date into matplotlibs internal format for representing dates... but I'm not sure - is this the correct approach? Is there any example code that I'm missing that plots data against the date? Cheers Adam - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users