Re: [Matplotlib-users] PIL + pyplot.savefig() size change
The dpi value, which can be overridden, will determine the size of the output image. It looks to me like you just want the output to always be the same size as your input image, so use imsave() instead of imshow() followed by savefig() for this: i.e. just do map = Basemap(..) pilImg = Image.open('bkgmap.gif') rgba = pil_to_array(pilImg) pyplot.imsave('outimg.png', rgba) On Fri, Sep 23, 2011 at 9:10 AM, Isidora isid...@juno.com wrote: Hi, I am new to matplotlib so I may not have found the right answer because I am looking in the wrong places. I wrote a script to draw lines on a 800x600 pixels GIF background map. The output image I get is 620x450. Could someone let me know what I am doing wrong? Code Snippet: map = Basemap(..) pilImg = Image.open('bkgmap.gif') rgba = pil_to_array(pilImg) map.imshow(rgba) # Plot some lines and labels here pyplot.savefig('outimg.png',format='PNG',bbox_inches='tight',pad_inches=0) Thank you -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do you Plot data generated by a python script?
As you show it, mass will be a string, so you'll need to convert it to a float first, then add it to a list. You can then manipulate the values in the list to compute your mean, or whatever, which matplotlib can use as input to its plot() function or whichever type of plot you're after. Alternatively, since the Python numpy module is made for manipulating data like this, it can probably read your data in a single function call and easily compute the things you want. However, if you are really that new to programming, you may struggle, so I'd suggest reading first going to scipy.org and reading up on numpy. When you understand the basics of numpy, matplotlib's documentation should make a lot more sense. Gary On Thu, Aug 25, 2011 at 6:48 AM, surfcast23 surfcas...@gmail.com wrote: I am fairly new to programing and have a question regarding matplotlib. I wrote a python script that reads in data from the outfile of another program then prints out the data from one column. f = open( 'myfile.txt','r') for line in f: if line != ' ': line = line.strip() # Strips end of line character columns = line.split() # Splits into coloumn mass = columns[8] # Column which contains mass values print(mass) What I now need to do is have matplotlib take the values printed in 'mass' and plot number versus mean mass. I have read the documents on the matplotlib website, but they don't really address how to get data from a script(or I just did not see it) If anyone can point me to some documentation that explains how I do this it would be really appreciated. Thanks in advance -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32328822.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can I change pixel aspect with axes_grid
Thanks Eric and JJ, Both of your answers are solutions to my problem actually. I spent a while trying to figure this out and didn't get anywhere. This was an exercise in frustration with matplotlib's documentation. Thankfully this list and its members are here to save us. I assumed it was just a simple flag or option I had missed and this turned out to be the case. I had even tried setting aspect=False when creating my AxesGrid object and setting aspect=auto, but because I was poking around in the dark, I must not have set both at the same time. I also thought I'd seen an example of this somewhere, which is what Eric pointed out, but even thinking I'd seen it, I couldn't find it again. I had looked in the gallery but missed the example - looking back at the gallery now, I think it might be because every other related example uses the jet colour scheme and it simply didn't register. regards, Gary On Sat, Aug 20, 2011 at 6:49 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: If you want aspect=auto, this must also be set when you create ImageGrid. A simple example is attached. If you want a fixed aspect other than 1, it is doable but gets a bit tricky. Let me know if this is what you want. Regards, -JJ from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) grid = ImageGrid(fig, 111, (2, 1), aspect=False, label_mode='L', cbar_mode=single, ) arr = np.arange(100).reshape((10, 10)) im1 = grid[0].imshow(arr, aspect=auto) im2 = grid[1].imshow(arr, aspect=auto) grid[0].cax.colorbar(im1) On Sat, Aug 20, 2011 at 2:43 PM, gru...@bigpond.net.au gru...@bigpond.net.au wrote: Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will display the image with pixels having some aspect ratio other than 1:1 However, I cannot get this to work when using imshow within an AxesGrid axis. Is there a way to get an array shown with imshow() within an AxesGrid axis to have a pixel aspect other than 1:1 ? If not, is there a simple way to add a shared colorbar when using subplots() ? Gary -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Can I change pixel aspect with axes_grid
Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will display the image with pixels having some aspect ratio other than 1:1 However, I cannot get this to work when using imshow within an AxesGrid axis. Is there a way to get an array shown with imshow() within an AxesGrid axis to have a pixel aspect other than 1:1 ? If not, is there a simple way to add a shared colorbar when using subplots() ? Gary -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Some more mplot3d questions
Hi Ben, Comments inline... On Fri, Jul 22, 2011 at 1:31 AM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Jul 21, 2011 at 1:10 AM, gary ruben gary.ru...@gmail.com wrote: I'm trying to make a surface plot using the latest version of mplot3d from the git trunk and I have a couple of questions. The attached image is close to what I would like. The associated plot command I am using is ax.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.8, shade=True, cmap=plt.cm.summer, color='k', facecolors='k', lightsource = LightSource(azdeg=0, altdeg=0), ) 1. Is there support now to automatically annotate the axis so that a multiplier is added, as occurs in 2D plots, or should I do this manually by rescaling the data for the moment? Yes, offset text is now automatic and should activate in similar manner as it does for regular 2D axis formatters. You were one order of magnitude off from automatically triggering it. Also, I should note that it might be better to use ax = fig.gca(projection='3d') instead of ax = Axes3D(fig) because the former will leave more of a margin, which would allow the offset text to be fully visible. Thanks. That's actually what I am doing but I cropped the output image before attaching it. If you want the full figure area, then you may need to fiddle with the ax.zaxis._axinfo['label']['space_factor'] to bring it and the axis label closer to the axis. Thanks. That's useful to know. The odd thing that I am encountering right now while investigating your problem is that I can't seem to force the use of the offset. It could just be that I am doing it wrong, but I will look closer. Yes, I had set 'axes.formatter.limits' : (-2, 2) hoping to trigger it - I guess that's what you tried. 2. Currently, it doesn't appear possible to shade the surface patches according to just a base facecolor and their orientation to a light source. Do I have to define a new colormap with a constant/single colour to achieve this? Looking over the plot_surface code, this appears to be the case, however, looking back over the LightSource code, I believe it might be possible to update plot_surface to operate on situations where no cmap is specified. I will take a look today at that possibility and see if I can get it out for the v1.1.0 release. That would be great - it is a very good way to visualize a surface so it should be made as simple as possible. 3. I have set alpha=0.8 to allow the wireframe lines to show through a little. When shade=False, the wireframe is visible but I lose orientation-based shading. Is there a way to overlay the wireframe properly when shade=True? In plot_surface, when shade=True, it appears that both the facecolors and the edgecolors are set to the same colors. The only reason why the lines show up when you set transparency is that that alpha value is applied only to the faces and not the edges. Specifically, the logic is as follows: if fcolors is specified, then set that color for both facecolor and edgecolor. Else, if a cmap is specified, then give the polygon collection the data, limits and norm it needs to determine color itself. Else, then use the value of color to specify only the facecolors. I think the first branch of this logic is a bit wonky. I agree, since fcolors must be specified in order to trigger the lightsource-based shading. I am inclined to make a small change that would only set the edgecolors if 'edgecolors' was not provided as a kwarg. This would enable users to specify the edgecolor they want without worrying about something else over-riding it. The only problem seems to be that there would be no shading of these grid lines. Would that still be acceptable to you? Absolutely acceptable. In fact I think it is preferable not to shade them. Thanks for your valuable feedback! Ben Root Thanks for being responsive to it :) regards, Gary -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] alpha settings in mplot3d
I haven't had a chance to look properly at the new mplot3d improvements that Ben Root has been working on, but I wonder whether it is easy now to set the axis properties so that the patches that form the axes no longer have an alpha value of 0.5? I really want them to be solid. The use case is that I often save images in a vector format for editing within inkscape, do some fiddling, then re-export as eps or pdf. If there are any semi-transparent objects, inkscape will rasterize the whole image, so it becomes necessary to first go through and manually set the alphas of all these patches to 1.0 before saving. A cursory look at the new code makes me hopeful that this is now possible since the setting from _AXINFO has been moved to the Axis constructor. Does that mean I'll be able to do something like ax._axinfo['x']['color']=(0.3,0.3,0.3,1) with the new version? Gary -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] alpha settings in mplot3d
Thanks Ben, that works nicely. Good work :) (except that inkscape is not nearly as good as matplotlib itself at optimising the resulting vector-based pdf to keep the file size down - not mpl's fault though). I just remembered, while trying this out, that there are two of every object forming the axis parts - two of every patch, grid line, tick line and label. It was this way before the latest changes also, but is there a reason, or is it a bug? It doesn't impact visually though. thanks for the great work on this, Gary On Wed, Jul 20, 2011 at 12:41 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Jul 19, 2011 at 9:25 PM, gary ruben gru...@bigpond.net.au wrote: I haven't had a chance to look properly at the new mplot3d improvements that Ben Root has been working on, but I wonder whether it is easy now to set the axis properties so that the patches that form the axes no longer have an alpha value of 0.5? I really want them to be solid. The use case is that I often save images in a vector format for editing within inkscape, do some fiddling, then re-export as eps or pdf. If there are any semi-transparent objects, inkscape will rasterize the whole image, so it becomes necessary to first go through and manually set the alphas of all these patches to 1.0 before saving. A cursory look at the new code makes me hopeful that this is now possible since the setting from _AXINFO has been moved to the Axis constructor. Does that mean I'll be able to do something like ax._axinfo['x']['color']=(0.3,0.3,0.3,1) with the new version? Gary Gary, Glad to hear that you are kicking the tires. To make it clear, the _axinfo dictionary is in the Axis3D object (of which there are 3 in a Axes3D object). So, it would be something like: ax.xaxis._axinfo['color'] = (0.3, 0.3, 0.3, 1) At least, in theory. Part of the reason why I did not want to make this dictionary official is because the above would not actually work as expected. Although something similar for tick line colors might, for example. Because of the inconsistencies and because I did not want to paint myself into a corner, I have made this dictionary explicitly users beware. However, there is hope for your problem! Use ax.xaxis.set_pane_color((0.3, 0.3, 0.3, 1)) instead! Let me know if you encounter any other problems. Ben Root -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] continous colour bar
The pre-defined hsv colour map has this property - can you use that? Otherwise, yes, it is possible to define any map you like. Gary R On Fri, Jul 8, 2011 at 12:55 PM, Ben Elliston b...@air.net.au wrote: Hi. I have a set of data with a range of (say) 0 to 100. Is it possible to get matplotlib to use the same colour for 0 and 100, so that the colours meet at the ends of the color bar? One workaround is to just manipulate the data (eg. using abs (x-50)), but I would rather not, if possible. Thanks, Ben -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Boundary edges of a set of points
If you generate a big list of all the edges from the triangle data, you should get repeat entries only for all the internal edges. You could then find all the duplicates using this recipe http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c i.e. dups = [x for x in list_a if list_a.count(x) 1] After removing all of these, you should be left with just the boundary edges. Gary R. On Fri, Apr 29, 2011 at 7:56 AM, Luke hazelnu...@gmail.com wrote: Ian, Thanks for the response and the example code. I guess what I'm trying to do might be well defined. Here is a plot that should illustrate the data I'm working with: http://biosport.ucdavis.edu/blog/copy_of_steady_benchmark_tau.png The green and red regions are being displayed by plotting each and every point in my data set that is stable. So the set of points I was describing in my original message looks like these green and red regions. What I would like is just the boundary of the stable region, which maybe isn't a very well defined statement. The convex hull of these points would enclose a part of the x-y plane that isn't stable, so I don't want to include it in my plot. I am thinking that perhaps the approach I should be taking should involve contouring the real part of the eigenvalues which determine the stability, and then plot the zero-level curve. I'll have to think about that some more. Is it clear what I am trying to do? If so, do you think the Delaunay triangulation is the right way to go? ~Luke On Thu, Apr 28, 2011 at 2:14 PM, Ian Thomas ianthoma...@gmail.com wrote: On 28 April 2011 08:51, Luke hazelnu...@gmail.com wrote: I have a set of unstructured (x,y) points which I would like to compute a boundary polygon for. I don't want the convex hull. I was able to use matplotlib.tri to get a Delaunay triangulation for my points by following the examples online, but I'm having trouble masking everything but the triangles with a boundary edge. Additionally, once I get this, I'm not clear on how to plot just the boundary. Here is what it seems like the mask should be, assume triang comes from matplotlib.tri.Triangulation(). mask = np.where(np.where(triang.neighbors 0, 0, 1).all(axis=1), 1, 0) triang.set_mask(mask) but, when I plot triang using plot.triplot(), or plt.plot() to plot the edges, I am getting a bunch of extra stuff that isn't just the boundary triangles/edges. Anybody have example code for properly masking and plotting only the boundary edges? ~Luke Luke, I am not entirely clear exactly what you want to do, but I'll try to help. Your masking of the triangulation masks the triangles not the edges, and so your triplot call displays those triangles that include a boundary edge but also the other edges of those triangles. As you say, this isn't what you want. I've attached an example script that follows on from your idea of testing triang.neighbors to determine the boundary edges, and displays just those edges. However, this is the convex hull as, by definition, the boundary of an unconstrained Delaunay triangulation is the convex hull. As you don't want the convex hull, I am not clear what you want instead. If I have misunderstood your requirements and/or you have further questions, please post your example code as it is much easier for others on the mailing list to correct existing code than come up with their own freestanding example. I hope some of this helps! Ian Thomas -- Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin, Historical Review of Pennsylvania, 1759 -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] LaTeX matplotlib Bug?
Um, how about r$80--120$ instead of r$80--120 ? On Wed, Apr 6, 2011 at 9:56 AM, Sean Lake odysseus9...@gmail.com wrote: Hello all, I'm trying to specify a range of numbers in a particular legend using LaTeX. In order to do so I'm feeding it the string: r$80--120. The output should be have an endash, 80–120, but I'm getting 80--120. This is a standard feature of LaTeX ( http://en.wikibooks.org/wiki/LaTeX/Formatting ), so I don't know what's going on. Thanks, Sean Lake uname -a Darwin dynamic_051.astro.ucla.edu 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386 (You also have a bug on this web page: http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#reporting-problems , The line python -c `import matplotlib; print matplotlib.__version__` should not have back-ticks) /sw/bin/python2.6 -c 'import matplotlib; print matplotlib.__version__' 1.0.0 Got matplotlib via fink: fink --version Package manager version: 0.29.21 Distribution version: selfupdate-rsync Sun Apr 3 02:28:24 2011, 10.6, x86_64 Trees: local/main stable/main stable/crypto unstable/main unstable/crypto matplotlibrc file: text.usetex : True #backend : MacOSX backend : GTKAgg #backend : ps #backend : pdf -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] jitter in matplotlib?
I haven't seen this done before so I don't know if there's a standard way. The idea seems to be to take some points which are real data, create a random variable for each point with the points' position as the mean, then choose some number of points from each distribution to create some new points clustered around the original data. Some examples online seem to use uniform distributions and Poisson distributions or mixtures of these (uniform for the x-variable and Poisson for the y). If my take on this is correct, you can use scipy.stats to do this - an example is in the attached file which creates Gaussian distributions for each of the x and y coordinates then creates an equal number of new points for each of the seed points. The online examples I saw seem to choose random numbers of new points for each seed point. I didn't bother trying to cover all the possibilities. Hopefully this is helpful, Gary R. On Thu, Feb 24, 2011 at 3:04 PM, Uri Laserson laser...@mit.edu wrote: Hi all, I am interested in jittering points in a plot. I searched the forum, but I am amazed at the dearth of results on the topic. I am referring to something like this: http://goo.gl/Db47s or http://goo.gl/BjIZt Is there a standard way people do this with MPL? Thanks! Uri ... Uri Laserson Graduate Student, Biomedical Engineering Harvard-MIT Division of Health Sciences and Technology M +1 917 742 8019 laser...@mit.edu jitter.py Description: Binary data -- Free Software Download: Index, Search Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with imshow
You might want to try out the visvis module instead of matplotlib for interactive viewing of large 2D images - my system is also Win64 with 4GB and visvis.imshow() handles a 4k*4k image. You'll probably also want to disable ipython's object caching if you're doing a lot of this interactive viewing of large images. Gary R On Thu, Feb 3, 2011 at 10:59 AM, Christoph Gohlke cgoh...@uci.edu wrote: On 2/2/2011 3:33 PM, Robert Abiad wrote: Hello All, I'm very new to python, so bear with me. I'd like to use python to do my image processing, but I'm running into behavior that doesn't make sense to me. I'm using Windows 7 Pro (64-bit) with 4 gigs of memory, python 2.6.6, and the newest versions of ipython, pyfits, matplotlib (1.0.1), numpy (1.5.1), scipy. I'm loading in a fits file that's 26 MB (~16 Mpixels). When I load my image in ImageJ, I can see memory usage go up by 50MB, but when I try displaying the image using imshow(), my memory usage goes up by around 500MB, each time. If I close the figure and replot it, imshow() crashes. I don't know if I'm doing something wrong, or if it's a new or known bug. I tried the same thing on Linux and got the same result. Here's a transcript. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: import pyfits In [2]: from Tkinter import * In [3]: import tkFileDialog In [4]: image=pyfits.getdata(tkFileDialog.askopenfilename()) In [5]: imshow(image) Out[5]:matplotlib.image.AxesImage object at 0x03BCA170 In [6]: close() In [7]: imshow(image,origin='lower') Out[7]:matplotlib.image.AxesImage object at 0x0440E170 In [8]: close() In [9]: imshow(image[100:3600,100:3600],origin='lower') Out[9]:matplotlib.image.AxesImage object at 0x045D9FB0 In [10]: Exception in Tkinter callback Traceback (most recent call last): File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\app\Python2.6\lib\lib-tk\Tkinter.py, line 495, in callit func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 263, in idle_draw self.draw() File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 248, in draw FigureCanvasAgg.draw(self) File C:\app\Python2.6\lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\axes.py, line 1946, in draw a.draw(renderer) File C:\app\Python2.6\lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 354, in draw im = self.make_image(renderer.get_image_magnification()) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 569, in make_image transformed_viewLim) File C:\app\Python2.6\lib\site-packages\matplotlib\image.py, line 201, in _get_unsampled_image x = self.to_rgba(self._A, self._alpha) File C:\app\Python2.6\lib\site-packages\matplotlib\cm.py, line 193, in to_rgba x = self.norm(x) File C:\app\Python2.6\lib\site-packages\matplotlib\colors.py, line 820, in __call__ result = (val-vmin) / (vmax-vmin) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 3673, in __div__ return divide(self, other) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 1077, in __call__ m |= filled(domain(da, db), True) File C:\app\Python2.6\lib\site-packages\numpy\ma\core.py, line 772, in __call__ return umath.absolute(a) * self.tolerance= umath.absolute(b) MemoryError Thanks for any help, -robert These are previous discussions on the issue: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14727.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19815.html http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19614.html Christoph -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___
Re: [Matplotlib-users] Memory usage
No problem. This caught me out a long time ago and has also caught out a few people I know. On Fri, Jan 14, 2011 at 8:23 PM, CASOLI Jules jules.cas...@cea.fr wrote: Hooo, well done! This is it. I didn't knew about caching... I was indeed using ipython, but I did led some test using the basic python interpreter,with same results, so I did not mention this point. In fact, python's basic interpreter still records the last three outputs. As my tests were really short (plt.close() ; mpl.cbook.report_memory() ; gc.collect() is only two lines before the collect, only o)ne o,f theme outputt ing something) even pyhton's caching was still at work, and the garbage collector could not free anything. Thanks a lot, and also thanks to Ben for taking interest ! Jules PS : Gary, sorry, for the duplicated mail... -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. 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] Memory usage
You're not doing this from ipython are you? It's cache hangs onto the plot object references and stops python's garbage collector from releasing them. If so, you can disable the cache as a workaround. A better option would be if ipython implemented an option to avoid caching references to matplotlib objects. Gary R. On Fri, Jan 14, 2011 at 2:59 AM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Jan 13, 2011 at 7:54 AM, CASOLI Jules jules.cas...@cea.fr wrote: Hello to all, This is yet another question about matplotlib not freeing memory, when closing a figure (using close()). Here is what I'm doing (tried with several backends, on MacOSX and Linux, with similar results): import matplotlib as mpl from matplotlib import pylot as plt import numpy as np a = np.arange(100) mpl.cbook.report_memory() # - output: 54256 plt.plot(a) mpl.cbook.report_memory() # - output: 139968 plt.close() mpl.cbook.report_memory() # - output: 138748 Shouldn't plt.close() close the figure _and_ free the memory used by it? What am I doing wrong ? I tried several other ways to free the memory, such as f = figure(); ... ; del f, without luck. Any help appreciated ! P.S. : side question : how come the call to plot take so much memory (90MB for a 8MB array ?). I have read somewhere that each point is coded on three RGB floats, but it only means an approx. 12MB plot... (plus small overhead) Jules Jules, Which version of Matplotlib are you using and which backend? On my Linux install of matplotlib (development branch) using GTKAgg, the memory usage does get high during the call to show(), but returns to (near) normal amounts after I close. An interesting observation is that if the interactive mode is off, the memory usage returns back to just a few kilobytes above where it was before, but if interactive mode was turned on, the memory usage returned to being a few hundred kilobytes above where it started. Ben Root P.S. - As a side note, estimating the memory size of these plots from the given data isn't as straight-forward as multiplying by three (actually, it would be four because of the transparency value in addition to rgb). There are many other parts of the graph that needs to be represented (all having rgba values) but there are also a lot of simplifications that are done to reduce the amount of memory needed to represent these objects. -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. 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] how do I specify the line join and cap style?
Thanks for the workaround JJ. I've filed a feature request, Gary On Mon, Dec 13, 2010 at 9:54 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: It seems that there is no option to change join and cap style for patches (only lines have them). While there could be other ways, one workaround is to use patheffect. Below is a modified version of your example. Meanwhile, I think the situation needs to be fixed, i.e., Patches should implement set_capstyle and set_joinstyle. Can you file a feature request on the tracker? Regards, -JJ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar from matplotlib.patheffects import Stroke def add_sizebar(ax, size): asb = AnchoredSizeBar(ax.transData, size, str(size), loc=8, pad=0.1, borderpad=0.5, sep=5, frameon=False) ax.add_artist(asb) mypatch = asb.size_bar.get_children()[0] mypatch.set_path_effects([Stroke(joinstyle='miter', capstyle='butt')]) # override joinstyle and capstyle add_sizebar(plt.gca(), 0.5) plt.draw() plt.show() On Mon, Dec 13, 2010 at 9:16 AM, gary ruben gru...@bigpond.net.au wrote: Is it possible to control the join and cap styles of lines and patches? Is there an example for this? I'm trying to add a scale marker to a plot, but lines have rounded ends by default, so I'm currently changing these manually in Inkscape to miter join and butt cap. Here is a minimal example, based on the code here: import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar def add_sizebar(ax, size): asb = AnchoredSizeBar(ax.transData, size, str(size), loc=8, pad=0.1, borderpad=0.5, sep=5, frameon=False) ax.add_artist(asb) add_sizebar(plt.gca(), 0.5) plt.draw() plt.show() What I'd like is a 2pt wide line with butt-style cap ends, thanks, Gary -- Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Documentation suggestions (longish post)
I've been helping a fairly new Python user (an astronomer using numpy/scipy/matplotlib) in my office get up to speed with matplotlib and thought I'd pass on a couple of small thoughts about the documentation which we think would make life clearer for new users. I'm putting this out for discussion, because it may be totally off-the-mark. On the other hand, it may point to some easy changes to make things clearer for new users. First, I think that a new user, presented with the mpl homepage, reads the intro on that page, then perhaps clicks through to either the pyplot, examples, or gallery pages. They may take example code from examples or gallery and modify them for their own plots, but they will at some point be referencing the pyplot page (this is also my most-visited page on the site). The matplotlib.pyplot page would really benefit from a few introductory paragraphs or even a single sentence with a link to the relevant section in the docs, explaining what the relationship of pyplot is to the other parts of mpl. Specifically, I think confusion arises because the explanation about the stateful nature of the pyplot interface is (I think) first mentioned at the start of the pyplot tutorial page, and is perhaps not emphasized enough. It may also be worth stating somewhere in the front-page mpl intro that it is recommended that new users do the pyplot tutorial. The signatures that a new user sees are full of *args and **kwargs which is confusing for the new user. There is an explanation in the coding guide so perhaps another paragraph or sentence+link to this would help, but I think it's probably not a good idea to be directing new users into the coding guide. I know about the history of this and I gather that most or all of the args are actually tabulated in the documentation now, but new users don't necessarily know what *args and **kwargs mean. I think there's still a general lack of consistency in the pyplot docs related to this. Some docstrings have the call signature shown, with default values shown. It's confusing that some kwargs have explicit descriptions and appear in the call signature whereas others are just additional kwargs. This split seems to me to be exposing the underlying implementation of the function to the user. I don't know whether there is logic behind this. The final area of confusion is to do with jargon, as this seems to creep into examples and list discussions. The introduction to the Artist Tutorial is quite useful for understanding mpl's plotting model. However, for the new user, it is pretty much impenetrable due to the jargon and references to other libraries and coding concepts that a new user doesn't need to know. I think a gentler description of mpl's plotting model in the introduction or in a standalone small chapter would be helpful for new users. Gary R. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot rgb spectrum
Hi Tymoteusz, I think this does what you want (see attached). I'm not sure about 3D though. Gary R. Tymoteusz Jankowski wrote: Hi! Can anyone help me to achive this? I'd like to plot rgb spectrum with matplotlib. For example let the x axis be green element, and for example... let the y axis be red element. Eventually i'd like to plot 3D figure with all of three elements RGB. Regards, T. import matplotlib.pyplot as plt import numpy as np a = np.outer(np.arange(0,256), np.ones(256,dtype=np.uint8)) rgb = np.zeros((256,256,3), dtype=np.uint8) rgb[:,:,0] = a rgb[:,:,1] = a.T plt.imshow(rgb, origin='lower', interpolation='nearest') plt.show()-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] visualizing colormaps for complex functions
Hi Guy, I am also interested in the answer to this. The cplot function in the mpmath module does exactly this using matplotlib, but very inefficiently, as it computes the colour of each pixel in the image in hls colour-space and generates the corresponding rgb value directly. I suspect this is how it has to be done, as colormaps in matplotlib are 1D sequences and the black-white (lightness) value is really another dimension. However mpmath's method can be improved by doing the mapping using array operations instead of computing it for each pixel. I've attached a function I wrote to reproduce the Sage cplot command in my own work. It's a bit old and can be improved. It takes the Arg and Abs of a complex array as the first two arguments - you can easily change this to compute these inside the function if you prefer. The line np.vectorize(hls_to_rgb) can be replaced - recent versions of matplotlib have a vectorized function called hsv_to_rgb() inside colors.py - so you replace the return line with the commented-out version if you first import hsv_to_rgb from colors. I hope this helps. I'm also curious: the plots you point to also show plots of the function extrema, which are the phase singularities - does mathematica have a function that gives you these, or did you write your own function to find them? regards, Gary Guy Rutenberg wrote: Hi, Is there a way to generate colormaps for complex-valued functions using matplotlib? The type of plots I'm looking for are like the plots in: http://commons.wikimedia.org/wiki/User:Jan_Homann/Mathematics Thanks in advance, Guy def cplot_like(ph, intens=None, int_exponent=1.0, s=1.0, l_bias=1.0, drape=0, is_like_mpmath=False): ''' Implements the mpmath cplot-like default_color_function The combined image is generated in hls colourspace then transformed to rgb *phase* A filename or 2D n x m array containing phase data in the range -pi-pi *intens* If None, set to 1.0 A filename or 2D n x m array containing intensity or amplitude data in the range 0-max *int_exponent* Default 1.0 applies the intens mask directly to the hls lightness-channel 0.6 works well when drape==0 *s* saturation. Defaults to 1.0. mpmath uses 0.8. *l_bias* biases the mean lightness value away from 0.5. mpmath uses 1.0. Examples are: l_bias=2 - mean=0.33 (ie darker), l_bias=0.5 - mean=0.66 (lighter) *drape* If 1, drapes a structured maximum filter of size drape x drape over the intensity data *is_like_mpmath* If True, sets int_exponent = 0.3, s = 0.8 ''' from colorsys import hls_to_rgb if type(ph) is str: cph = plt.imread(ph)/256.*2*pi-pi # -pi-pi if len(cph.shape) == 3: cph = cph[...,0] # if ph is RGB or RGBA, extract the R-plane else: cph = ph.copy() if intens is None: cintens = np.ones_like(cph) elif type(intens) is str: cintens = plt.imread(intens)/255. # 0-1 if len(cintens.shape) == 3: cintens = cintens[...,0] # if intens is RGB or RGBA, extract the R-plane else: cintens = intens.copy() cintens /= cintens.max() # autoscale intensity data to 0-1 if drape 1: # envelope the intensity cintens = maximum_filter(cintens, size=drape) h = ((cph + pi) / (2*pi)) % 1.0 if is_like_mpmath: # apply mpmath values int_exponent = 0.3 s = 0.8 l = 1.0 - l_bias/(l_bias+cintens**int_exponent) v_hls_to_rgb = np.vectorize(hls_to_rgb) #~ return hsv_to_rgb(dstack((h,np.ones_like(h),l))) return dstack(v_hls_to_rgb(h,l,s))-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using colourmap from matplotlib
I haven't tried it, but maybe it's to do with the fact that you're quantising the colourmap to 256 values; I think matplotlib computes the exact rgb values using interpolation. If the only reason you're using PIL is to get a .bmp file, maybe you could save the file straight from matplotlib as a .png then externally convert it to a .bmp Gary R. Ciarán Mooney wrote: Hi, I am trying to create an image from an array using PIL, numpy and a colourmap from matplotlib. snip I'd like to get something that looks the same. I don't think the problems are because of the colourmap but rather because of my log scaling. Could someone please explain how matplotlib scales the image to make it look so nice? Regards, Ciarán -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] save image from array?
Hi Nico, I'm pretty sure the functionality is buried in there but unfortunately I couldn't figure out how to put it into the imsave function, so for now I think you have to resort to using PIL to do this. Gary R. Nico Schlömer wrote: Hi, I see that with imsave() it's possible to save an image based on its cmap. Is there also functionality in matplotlib to to store a file based on RGB(alpha) information? Cheers, Nico -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] basemap problem
I just installed the latest EPD 6.0.2 Python 2.6-based distribution in WinXP. The mpl version is 0.99.1.1 and I installed basemap using the basemap-0.99.4.win32-py2.6.exe binary installer. I'm getting this traceback. Any ideas? Gary -- In [1]: from mpl_toolkits.basemap import Basemap --- ValueErrorTraceback (most recent call last) C:\PYTHON26\ipython console in module() C:\Python26\lib\site-packages\mpl_toolkits\basemap\__init__.py in module() 36 from matplotlib.lines import Line2D 37 from matplotlib.transforms import Bbox --- 38 import pyproj, sys, os, math, dbflib 39 from proj import Proj 40 import numpy as np C:\Python26\lib\site-packages\mpl_toolkits\basemap\pyproj.py in module() 46 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 47 --- 48 from _proj import Proj as _Proj 49 from _geod import Geod as _Geod 50 from _proj import _transform C:\PYTHON26\c_numpy.pxd in _proj (src/_proj.c:3234)() ValueError: numpy.dtype does not appear to be the correct type object -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap problem
Hang on - I just noticed EPD says it contains basemap already, so maybe installing over the top of it did something - I'll trying uninstalling and doing a repair of EPD. Gary Gary Ruben wrote: I just installed the latest EPD 6.0.2 Python 2.6-based distribution in WinXP. The mpl version is 0.99.1.1 and I installed basemap using the basemap-0.99.4.win32-py2.6.exe binary installer. I'm getting this traceback. Any ideas? Gary -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap problem
OK, that worked. Sorry for the noise. I forgot basemap gets put under site-packages/mpl_toolkits. When I installed a second copy using the basemap binary installer, it went under site-packages and caused some sort of conflict. Gary Gary Ruben wrote: Hang on - I just noticed EPD says it contains basemap already, so maybe installing over the top of it did something - I'll trying uninstalling and doing a repair of EPD. Gary Gary Ruben wrote: I just installed the latest EPD 6.0.2 Python 2.6-based distribution in WinXP. The mpl version is 0.99.1.1 and I installed basemap using the basemap-0.99.4.win32-py2.6.exe binary installer. I'm getting this traceback. Any ideas? Gary -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] define color cycle in matplotlibrc
I'm happy for it to remain just a suggestion and not a reality. I mentioned it in case it was easy to implement alongside the color cycle but it seems it is not. Thanks for considering it anyway Eric, Gary Eric Firing wrote: Dominik Szczerba wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eric Firing wrote: Dominik Szczerba wrote: OK I started hacking and added a color_cycle property to matplotlibrc. Would you be so kind to add this fix to the official version? Thanks! Dominik -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] define color cycle in matplotlibrc
One nice thing about gnuplot is the option its GUI provides to toggle between using coloured lines and using black lines with various dashed patterns. I think it would be nice in matplotlib to also be able to have a default series of dashed patterns that could automatically be cycled through. Gary R Eric Firing wrote: Dominik Szczerba wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 OK I started hacking and added a color_cycle property to matplotlibrc. Would you be so kind to add this fix to the official version? Thanks! Dominik Your basic idea--that the colorcycle should be settable in rcParams--makes good sense, but the implementation needs some changes, maybe including a bit of redesign of the color cycle handling. I will look into it. A little discussion on the devel list may be required. I think we will want to completely decouple lines.color from a new lines.colorcycle, but maybe there is some good reason, other than history, for why they are coupled. -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] I Need a Couple of Tips for Windows to Get Started on IPython
Wayne Watson wrote: I thought the console was the only way to use IPython. I go to Start-Allprograms-IPython, and select IPython. Oh, I see *Console is something of a replacement for the Win Cmd Console. Is there some site that shows off it's features? Not that I know of. By the way, in case you haven't set it up a shortcut to Console that starts up IPython, I did it like this: I created a shortcut to console in my start menu: Properties|Shortcut Target: C:\Program Files\Console2\Console.exe Start in: C:\Program Files\Console2 Then in Console, under Edit|Settings|Tabs Create a tab with Main|Title icon|Title: iPython Shell|Shell: C:\PYTHON25\Scripts\ipython.exe -pylab -wthread -p pylab Shell|Startup dir: C:\Python25 -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] I Need a Couple of Tips for Windows to Get Started on IPython
In Windows I recommend running iPython inside Console http://sourceforge.net/projects/console/ particularly for its vastly improved copy and pasting. Gary R. phob...@geosyntec.com wrote: Third Google result for copy paste in DOS prompt http://www.copy--paste.org/copy-paste-between-dos-windows.htm Note that right-clicking is going to execute behavior, not bring up a contextual menu. -p -Original Message- From: Wayne Watson [mailto:sierra_mtnv...@sbcglobal.net] Sent: Monday, December 07, 2009 12:57 PM To: Gary Pajer Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] I Need a Couple of Tips for Windows to Get Started on IPython Right-click does nothing on the IPython window. The Windows command console is, I think, a lost cause all together. I've tried a right-click on it with the same result as in IPython. I'm using Win XP, and I hope they improve on Win 7, which I plan to install on all my machines this month. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Arrows between points in a plot?
Hi Michael, Take a look at the quiver demo http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html and the annotation2 demo http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html More generally, have a look through the examples and gallery pages http://matplotlib.sf.net/examples/index.html http://matplotlib.sf.net/gallery.html Gary R. Michael Cohen wrote: Hi all, I have a plot that has say 6 black X's, each separate, and 6 blue X's, also separate, denoting where x's 1-6 have moved to (from black to blue). Currently each point is plotted with a separate plot function. I would like to generate a plot where each black x and blue x pair has an arrow pointing from one to the other. Currently I plot them like this: x1black = value y1black = value plot([x1black],[y1black],'kx',markersize=10,markeredgewidth=2) x1blue = value y1blue = value plot([x1blue],[y1blue],'bx',markersize=10,markeredgewidth=2) If I plotted, plot([x1black,x1blue],[y1black,y1blue]) I could make the line between them into an arrow, but I wouldn't be able to make one blue and the other black. Also, I'd like to be able to curve my arrows to make them less confusing in case they intersect too much. Can anyone point me to the right functions? Cheers Michael -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] separate sub-forum for basemap?
IMO I don't think the traffic level on either pure mpl or basemap warrants a split. Gary R. Dr. Phillip M. Feldman wrote: It seems as though there are enough basemap-related posts that it might be worth creating a separate basemap-specific sub-forum of the matplotlib forum. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] query abuot plotting polygons using a basemap projection
Hi Jeff, I finally had a chance to try this. I can't get it to work but I think I'm close - for some reason, the way I'm creating the geos polygons seems to always intersect the boundary polygon. It's hard to think of a good minimal example for this so I've attached an example that illustrates the problem - it tries to plot an icosahedron on the Mollweide plot. Gary R. Jeff Whitaker wrote: Gary Ruben wrote: I'm plotting a coverage map of a sphere using the Mollweide plot in basemap. The attachment is an example that is produced by sending an array of polygons (one polygon per row described as four corners, one per column) described using polar (theta) and azimuthal (phi) angles to the following function. As a kludge, I discard any polygons that cross the map boundary, but this produces artefacts and it would be better to subdivide these and keep the parts. I was wondering whether there's a function I missed that allows me to add polygons and performs the split across the map boundary. Gary R. Gary: You might be able to use the _geoslib module to compute the intersections of those polygons with the map boundary. I do a similar thing with the coastline polygons in the _readboundarydata function. The _boundarypolyll and _boundarypolyxy instance variables have the vertices of the map projection region polygons in lat/lon and projection coords. You could do somethig like this: from mpl_toolkits.basemap import _geoslib poly = _geoslib.Polygon(b) # a geos Polygon instance describing your polygon) b = self._boundarypolyxy.boundary bx = b[:,0]; by= b[:,1] boundarypoly = _geoslib.Polygon(b) # a geos Polygon instance describing the map region if poly.intersects(boundarypoly): geoms = poly.intersection(boundarypoly) polygons = [] # polygon intersections to plot. for psub in geoms: b = psub.boundary # boundary of an intersection polygons.append(zip(b[:,0],b[:,1])) -Jeff from mpl_toolkits.basemap import Basemap, _geoslib import matplotlib.pyplot as plt from matplotlib.patches import Polygon import numpy as np from numpy import pi icosahedron = \ [[0.53,0.,-0.53,0.53,-0.53,0.,0.53,-0.53,0.,0.53,0., -0.53,0.85,0.53,0.85,0.85,0.85,0.53,-0.85,-0.53,-0.85, -0.85,-0.85,-0.53,0.,0.85,0.,0.,0.,-0.85,0.,0.,0.85, 0.,-0.85,0.,0.,0.53,0.85,0.,0.85,0.53,0.53,0.,0.85, 0.53,0.85,0.,-0.53,0.,-0.85,-0.53,-0.85,0.,-0.53, -0.85,0.,-0.53,0.,-0.85], [0.,0.85,0.,0.,0.,-0.85,0.,0.,0.85,0.,-0.85,0.,0.53, 0.,-0.53,0.53,-0.53,0.,-0.53,0.,0.53,-0.53,0.53,0., 0.85,0.53,0.85,0.85,0.85,0.53,-0.85,-0.85,-0.53,-0.85, -0.53,-0.85,0.85,0.,0.53,0.85,0.53,0.,0.,-0.85,-0.53, 0.,-0.53,-0.85,0.,0.85,0.53,0.,0.53,0.85,0.,-0.53, -0.85,0.,-0.85,-0.53], [0.85,0.53,0.85,0.85,0.85,0.53,-0.85,-0.85,-0.53,-0.85, -0.53,-0.85,0.,0.85,0.,0.,0.,-0.85,0.,0.85,0.,0.,0., -0.85,0.53,0.,-0.53,0.53,-0.53,0.,0.53,-0.53,0.,0.53, 0.,-0.53,0.53,0.85,0.,-0.53,0.,-0.85,0.85,0.53,0., -0.85,0.,-0.53,0.85,0.53,0.,-0.85,0.,-0.53,0.85,0., 0.53,-0.85,-0.53,0.]] icosahedron1 = \ [[0.53, 0. ,-0.53, 0.53,-0.53, 0. ], [0. , 0.85, 0. ,0. , 0. ,-0.85], [0.85, 0.53, 0.85 ,0.85, 0.85, 0.53]] def pointsOnSphere(): x,y,z = np.array(icosahedron)/0.851 return 180/pi*np.arcsin(z), 180/pi*np.arctan2(y,x) if __name__=='__main__': if 0: from enthought.mayavi import mlab x,y,z = icosahedron sphere = mlab.triangular_mesh(x, y, z, \ np.arange(len(x)).reshape(-1,3), representation = 'wireframe') mlab.show() raise SystemExit # Make Mollweide plot m = Basemap(projection='moll', lon_0=0, resolution='c') # draw the edge of the map projection region (the projection limb) m.drawmapboundary() theta, phi = pointsOnSphere() theta.shape = phi.shape = (-1,3) print theta.shape[0], 'polys' ax = plt.gca() # get current axes instance # create a geos Polygon instance describing the map region boundarypoly = _geoslib.Polygon(m._boundarypolyxy.boundary) for i in range(theta.shape[0]): pts = np.vstack((phi[i], theta[i])).T polypts = np.array([m(*pt) for pt in pts]) # to projection coords poly = _geoslib.Polygon(polypts) # geos polygon for testing if poly.intersects(boundarypoly): for psub in poly.intersection(boundarypoly): b = psub.boundary # boundary of an intersection polypts = zip(b[:,0],b[:,1]) c = (1,) + tuple(np.random.random(2)) # warm colour poly = Polygon(polypts, facecolor=c, edgecolor=c) ax.add_patch(poly) else: c = tuple(np.random.random(2)) + (1,) # cool colour poly = Polygon(polypts, facecolor=c, edgecolor=c
Re: [Matplotlib-users] Circular colormaps
Hi Ariel, You might find the attached function helpful here. Try creating a new colormap using the example in the docstring (you could also try setting high=0.8) - basically this will let you turn down the saturation which will hopefully solve your problem. You may also find the plot option useful to see what the individual colour channels are doing if you decide to make a new colormap of your own - you just need to ensure that the r, g, and b values match at both ends. Gary Ariel Rokem wrote: Hi everyone, I am interested in using a circular colormap, in order to represent a phase variable, but I don't like 'hsv' (which is circular). In particular, I find that it induces perceptual distortion, where values in the green/yellow part of the colormap all look the same. Are there any circular colormaps except for 'hsv'? If not - how would you go about constructing a new circular colormap? Thanks, Ariel -- Ariel Rokem Helen Wills Neuroscience Institute University of California, Berkeley http://argentum.ucbso.berkeley.edu/ariel import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib._cm as _cm def rescale_cmap(cmap_name, low=0.0, high=1.0, plot=False): ''' Example 1: my_hsv = rescale_cmap('hsv', low = 0.3) # equivalent scaling to cplot_like(blah, l_bias=0.33, int_exponent=0.0) Example 2: my_hsv = rescale_cmap(cm.hsv, low = 0.3) ''' if type(cmap_name) is str: cmap = eval('_cm._%s_data' % cmap_name) else: cmap = eval('_cm._%s_data' % cmap_name.name) LUTSIZE = plt.rcParams['image.lut'] r = np.array(cmap['red']) g = np.array(cmap['green']) b = np.array(cmap['blue']) range = high - low r[:,1:] = r[:,1:]*range+low g[:,1:] = g[:,1:]*range+low b[:,1:] = b[:,1:]*range+low _my_data = {'red': tuple(map(tuple,r)), 'green': tuple(map(tuple,g)), 'blue': tuple(map(tuple,b)) } my_cmap = colors.LinearSegmentedColormap('my_hsv', _my_data, LUTSIZE) if plot: plt.figure() plt.plot(r[:,0], r[:,1], 'r', g[:,0], g[:,1], 'g', b[:,0], b[:,1], 'b', lw=3) plt.axis(ymin=-0.2, ymax=1.2) return my_cmap -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] query abuot plotting polygons using a basemap projection
Thank you Jeff. I'll try out this solution. Gary. Jeff Whitaker wrote: snip Gary: You might be able to use the _geoslib module to compute the intersections of those polygons with the map boundary. I do a similar thing with the coastline polygons in the _readboundarydata function. The _boundarypolyll and _boundarypolyxy instance variables have the vertices of the map projection region polygons in lat/lon and projection coords. You could do somethig like this: from mpl_toolkits.basemap import _geoslib poly = _geoslib.Polygon(b) # a geos Polygon instance describing your polygon) b = self._boundarypolyxy.boundary bx = b[:,0]; by= b[:,1] boundarypoly = _geoslib.Polygon(b) # a geos Polygon instance describing the map region if poly.intersects(boundarypoly): geoms = poly.intersection(boundarypoly) polygons = [] # polygon intersections to plot. for psub in geoms: b = psub.boundary # boundary of an intersection polygons.append(zip(b[:,0],b[:,1])) -Jeff snip -- Come build with us! The BlackBerry(R) 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 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow smoothing
Yes. Use interpolation='nearest' instead. Gary R. Michael Hearne wrote: Running the test script below gives me the image I have attached, which looks like it has been smoothed. Does imshow perform some sort of smoothing on the data it displays? If so, is there a way to turn this off? #!/usr/bin/env python from pylab import * data = array([[1,2,3,4],[5,6,7,8]]) imshow(data,interpolation=None) savefig('output.png') close('all') -- 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] plotting asymmetric error bars?
Hi Per, You need 2*N, not N*2 arrays here. I think you're also trying to use absolute values so you probably need something like this: plt.errorbar([1,2,3],[1,2,3],yerr=np.abs(a.T-[1,2,3])) I hope this is what you're after, Gary R. per freem wrote: hi all, i am trying to plot asymmetric yaxis error bars. i have the following code: import matplotlib.pyplot as plt a = array([[ 0.5, 1.5], [ 0.7, 2.2], [ 2.8, 3.1]]) plt.errorbar([1,2,3],[1,2,3],yerr=a) snip -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plt.gray dont' work with plt.scatter?
gray() sets the default colormap for raster-based plot commands like imshow(), matshow() and figimage(). For scatter(), you need to set the colors of plot elements invidually. Setting the facecolor in the scatter() command will work for the example you tried: scatter(x,y,s=area, marker='^', facecolor=(.7,.7,.7), c='r') Gary R. lotrpy wrote: Hello, Sorry for my broken english. I copy the source code from http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo.html Just Insert one line gray() before the last line show(). But the picture is sitll colorful. not a gray picture. It there somethig I missed. Thanks in advance. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] best format for MS word?
I haven't tried it myself, but this converter may do the trick. If it works, can you report back? I'd be interested to know: http://sk1project.org/modules.php?name=Productsproduct=uniconvertor Gary R. Shixin Zeng wrote: Hi, Could someone tell me what's the best format that matplotlib can produce for insertion to MS word? I'm working on a paper using MS word. I used matplotlib to produce the pictures in png' format, but my professor doesn't satisfy with the quality of the pictures, he asks me to do it in emf format, but I can't get an emf output from matplotlib. While other vector formats that are supported by matplotlib are not supported by MS word. I have worked days on producing this pictures, I don't want to abandon them just because they can't be imported to MS word. I really like to produce my pictures by using matplotlib, but I can't really throw away MS word. I also tried pstoedit to try to convert to emf from the ps, but it doesn't work on my system due to some weired missing procedure entry points in imagick dll. I'm kinda in a hurry, any help would be greatly appreciated. Best Regards Shixin Zeng -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] complex layouts of plots in matplotlib
Hi Per, The just-released mpl 0.99 contains Jae-Joon Lee's AxesGrid Toolkit http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html and Andrew Straw's support for axis spines http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html?highlight=spine I think these address both your questions. The list of new features is here: http://matplotlib.sourceforge.net/users/whats_new.html#new-in-matplotlib-0-99 Gary per freem wrote: Hi all, i am wondering if there is a way or an interface in matplotlib to design complex plot layouts. what i mean is something analogous to the 'layout' function of R, where you can say what portion of space each plot will take. i think this allows for more sophisticated layouts than the usual square matrix layouts that the 'subplot' function produces (unless i am missing some other usage of 'subplot'). -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] axes_grid examples
Many of the axes_grid examples in the thumbnail gallery don't work out of the box with the latest matplotlib 0.99 because they rely on demo_image and demo_axes_divider modules. Should these have been packaged with 0.99 or were they left out deliberately? Gary R. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] axes_grid examples
Thanks John. John Hunter wrote: On Mon, Aug 10, 2009 at 5:05 AM, Gary Rubengru...@bigpond.net.au wrote: Many of the axes_grid examples in the thumbnail gallery don't work out of the box with the latest matplotlib 0.99 because they rely on demo_image and demo_axes_divider modules. Should these have been packaged with 0.99 or were they left out deliberately? We've addressed this already in svn HEAD, but the fixes won't be out until mpl1.0. For now, just drop the attached file in the same directory as your example code (you may also need to touch a __init__.py in that dir. snip -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] crazy ideas for MPL
Is this an ideas thread? How about a copy image to clipboard button for the toolbar. Gary R. Pierre GM wrote: Eh, can I play ? * Something I'd really like to see is a way to access a given patch/ line/collection/... by a string (a name) instead of having to find the corresponding element in a list. That would mean converting lists into dictionaries, or at least provide a way to map the list to a dictionary. An example of application would be del lines['first'] to delete the line named 'first'. By default, if no name is explicitly given to an object, we could use the order in which it is drawn... -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlibrc customizing
When I f.e. change #xtick.labelsize : 14 (from '12') #xtick.direction : out (from 'in') Uncomment the lines. #xtick.labelsize : 14 #xtick.direction : out to xtick.labelsize : 14 xtick.direction : out -- 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] 3D plots
Hi Etienne, Sorry to hear about your disappointment. You can read about the attempt to resurrect the 3D plotting capabilities here: http://www.nabble.com/Updating-MPlot3D-to-a-more-recent-matplotlib.-td22302256.html Unfortunately, this doesn't help you right now. Depending on the type of 3D plotting you want to do, some suggestions for other packages that support 3D plotting from Python and work now are: Mayavi2's mlab interface http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab_3d_plotting_functions.html gnuplot.py http://gnuplot-py.sourceforge.net/ DISLIN http://www.mps.mpg.de/dislin R via RPy http://rpy.sourceforge.net/ and I'm pretty sure there are more too. Right now, if mayavi2 looks like it'll do what you want, I'd recommend it as your next stop. And in my opinion, I wouldn't say that your time spent learning matplotlib was wasted - 2D plotting is usually useful and matplotlib may soon again have limited 3D capability. Gary R. Etienne Gaudrain wrote: Hello list ! This is probably a recurrent topic, or even more probably HAVE been a recurrent topic... So sorry, sorry, sorry... I wanted to search the archives but Sourceforge is very slow today (...). Anyway, here is my question: Is it right that Matplotlib can no longer plot 3D graphes? snip Does it mean that all my efforts to understand and learn Matplotlib are just a big waste of time since I need another package now that I need 3D plot? So I ask you for advice: should I forget completely Matplotlib and move to MayaVI2? Or is there any plan to bring 3D back into Matplotlib, I mean to make a proper and complete alternative to Matlab? Or am I just upset because I am missing something. I only plot data every 4 or 6 months, and I really don't expect to see major functionalities to have disappeared when I come back to plotting data... is it a wrong expectation? Thanks !! -Etienne -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] On changing the default tick pad
Whilst agreeing with Kaushik's sentiments on the greatness of matplotlib, I thought his example plot nicely illustrates a layout wart that I think is easily fixed by changing the default xtick.major.pad, xtick.minor.pad, ytick.major.pad and ytick.minor.pad values from 4 to 6. As well as preventing the x- and y-axis labels running into each other in Kaushik's example, the most common case of a 2D plot with 0 lower bound on both the x- and y-axes [e.g. plot(rand(10))] looks better with the default font when pad=6. Just to bolster my case, according to the gestalt theory Law of Proximity http://en.wikipedia.org/wiki/Gestalt_psychology, the labels, which are currently closer to each other at the axis intersection than to the axes themselves become separated enough from one another so that they become visually associated with the axes in this region. As an aside, I went looking for Matlab plotting examples and some appear to match the pad=4 padding whereas others are more like pad=6. Of course I shall change this in my matplotlibrc file. I just thought I'd see if I could provoke a revolution, Gary R. -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] memory usage (leakage?) in ipython interactive mode
Hi Michael, Thanks for your explanation. It turns out that it is a combination of (1) and (3). I hadn't thought about (1) and I hadn't done enough playing to see the python interpreter releasing blocks of memory. As you suggested, the solution is to limit the iPython cache by using the iPython -cs option. thanks for your help, Gary Michael Droettboom wrote: There are at least three possible causes of what you're seeing here: 1) ipython stores references to all results in the console. (ipython maintains a history of results so they can easily be accessed later). I don't recall the details, but it may be possible to turn this feature off or limit the number of objects stored. 2) matplotlib stores references to all figures until they are explicitly closed with pyplot.close(fignum) 3) Python uses pools of memory, and is often imposes a significant delay returning memory to the operating system. It is actually very hard to determine from the outside whether something is leaking or just pooling without compiling a special build of Python with memory pooling turned off. In general, interactive use is somewhat at odds with creating many large plots in a single session, since all of the nice interactive features (history etc.) do not know automagically when the user is done with certain objects. I am not aware of any memory leaks in current versions of matplotlib with *noninteractive* use, other than small leaks caused by bugs in older versions of some of the GUI toolkits (notably gtk+). If you find a script that produces a leak reproducibly, please share so we can track down the cause. Gary Ruben wrote: Doing plot(rand(100)) or matshow(rand(1000,1000)) for example eats a big chunk of memory (tried with TkAgg and WxAgg in Windows (mpl v0.98.5.2) and Linux (mpl v0.98.3)), most of which is not returned when the window is closed. The same goes if you create an array, plot it, and explicitly del it after closing the window. Can you elaborate on these steps? It's possible that the del has little effect, since del only deletes a single reference to the object, not all references which may be keeping it alive (such as the figure, which matplotlib itself keeps a reference to). In general, you need to explicitly call pyplot.close(fignum) to delete a figure. Cheers, Mike -- 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
[Matplotlib-users] memory usage (leakage?) in ipython interactive mode
Is there a summary somewhere of the current state of knowledge about memory leaks when using the pylab interface interactively? Doing plot(rand(100)) or matshow(rand(1000,1000)) for example eats a big chunk of memory (tried with TkAgg and WxAgg in Windows (mpl v0.98.5.2) and Linux (mpl v0.98.3)), most of which is not returned when the window is closed. The same goes if you create an array, plot it, and explicitly del it after closing the window. I've seen lots of posts over the years about memory leaks, but there's nothing in the FAQ about this. I found old posts about similar things, but nothing that had a clear resolution. thanks, Gary -- 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
[Matplotlib-users] imsave() function
Hi all, I've attached a candidate imsave() to complement imread() in the image.py module. Would my use of pyplot instead of the oo interface preclude its inclusion in image.py? Also, I noticed some problems when I ran the tests with the Wx backends with mpl 0.98.5.2 in Win32. Both of the Wx backends produce incorrect, but different, results. Gary R. import numpy as np import matplotlib as mpl # Backend tests - uncomment in turn # mpl.use('Agg') # mpl.use('TkAgg') # mpl.use('WxAgg') # problem in Win32 with mpl 0.98.5.2 # mpl.use('Wx')# several problems in Win32 with mpl 0.98.5.2 # mpl.use('GTK') # mpl.use('GTKAgg') import matplotlib.pyplot as plt from matplotlib import rcParams import matplotlib.image as mpi from matplotlib import cm def imsave(fname, arr, clims=None, cmap=None, format=None, origin=None): Saves a 2D array as a bitmapped image with one pixel per element. The output formats available depend on the backend being used. Arguments: *fname*: A string containing a path to a filename, or a Python file-like object. If *format* is *None* and *fname* is a string, the output format is deduced from the extension of the filename. *arr*: A 2D array. Keyword arguments: *clims*: clims sets the color scaling for the image. It is a tuple (vmin, vmax) that is passed through to the pyplot clim function. If either *vmin* or *vmax* is None, the image min/max respectively will be used for color scaling. *cmap*: cmap is a colors.Colormap instance. *format*: One of the file extensions supported by the active backend. Most backends support png, pdf, ps, eps and svg. *origin* [ 'upper' | 'lower' ] Indicates where the [0,0] index of the array is in the upper left or lower left corner of the axes. Defaults to the rc image.origin value. ydim, xdim = arr.shape if cmap is None: cmap = eval('cm.' + rcParams['image.cmap']) if origin is None: origin = rcParams['image.origin'] f = plt.figure(figsize=(xdim,ydim), dpi=1) plt.axes([0,0,xdim,ydim]) plt.axis('off') plt.figimage(arr, cmap=cmap, origin=origin) if clims is not None: plt.clim(*clims) plt.savefig(fname, dpi=1, format=format) # tests imsave('test1.png', np.tri(100), origin='lower') imsave('test2.png', np.tri(100), origin='upper') imsave('test3png', np.random.random((100,100)), cmap=cm.Oranges, format='png') imsave('test4.png', np.hstack((np.tri(100)+np.tri(100)[:,::-1],np.vstack((np.eye(50),np.ones((50,50))*0.75,cmap=cm.gray) imsave('test5.png', np.vstack((np.tri(100),np.hstack((np.eye(50),np.ones((50,50))*0.25,cmap=cm.gray) imsave('test6.png', np.vstack((np.ones((100,100)),np.zeros((50,100) imsave('test7.png', np.eye(2)) imsave('test8.png', np.array([[1]])) -- Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] unfilled markers?
Hi Norbert, Both of your proposals (b) and (c) sound better to me than the current behaviour, although they don't sound as obvious to me as simply defaulting to always setting the mec to the line colour unless overridden using mec=k - you could label this proposal (d). Since others seem to have been happy with the black edges and I don't know how much extra logic (and consequently extra overhead) is required to change to (d), I'd be easily persuaded that (b) or (c) would be OK since, as you say, the black edge of filled markers is a matter of style preference and if black edges are not wanted on a particular plot that uses filled markers, the edge width can simply be set to zero. The decision might be guided by whichever results in the simplest logic or least overhead. regards, Gary Norbert Nemec wrote: Before my work in 2004, the colors were not following the line color at all, which was clearly bad behavior. Now, there are two categories: filled markers (with edge color black and filling following the line color) and non-filled markers (with edge color following line color). The black edge of filled markers is a matter of style which I personally like and would not want to change. The thing that was up for dispute was only about what the edge color of filled markers should do when the filling is switched off. I see three ways to solve this: a) Leave it black. (current behavior) b) Switch mec to line color if mfc is either none or white. c) Switch mec to line color if mfc is not auto b) or c) might be what people would expect and prefer, but I feared that it would be one step too many in built-in intelligence. But then - maybe c) would be ok? After all, switching from c) to a) by an explicit mec=k is simple and obvious, the other way around takes a bit more. Greetings, Norbert -- 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] unfilled markers?
It just occurred to me that another option might be to simply add a new colour option line for mec and mfc which would instruct them to pick up the current line colour. Gary -- 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] unfilled markers?
Has the mec always been black? I thought it used to be the same as the line colour. I expected it to default to the line colour, as Che expected. Gary R. Norbert Nemec wrote: Sorry for my misleading words - I did not correctly recall my own work from back then... In fact, the code as it is does not change the mec automatically when the mfc of a filled_marker is set to None but leaves it black. I did consider adding an automation to change but decided against it. The logic would have become too complex and hard to predict. What you can do is setting the mec afterwards using get_color on the plot like pl, = plot(x,y,-o,mfc=None) pl.set_mec(pl.get_color()) Hope that helps? Greetings, Norbert -- 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] unfilled markers?
Thanks John, That shows how long it is since I used line markers in my plots. Because I use them so infrequently, I'm probably not the best one to suggest it, but I think it would be nicer for the default colour to match the line colour by default, or for an option to be added to allow its simple selection without users having to search through the mailing list to find Norbert's solution. If I was publishing a colour plot with line markers I would definitely want to do this. Gary John Hunter wrote: On Mon, Jan 26, 2009 at 6:17 AM, Gary Ruben wrote: Has the mec always been black? I thought it used to be the same as the line colour. I expected it to default to the line colour, as Che expected. It's been this way since at least 2004: http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/__init__.py?revision=540view=markup JDH -- 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] different behaviour in Windows and Linux
I'm wondering whether someone can reproduce the following problem I'm seeing in Ubuntu Intrepid. I often use matplotlib to save images created with imshow to take advantage of matplotlib's colour maps. I've noticed that the behaviour is different for 0.98.3 between Windows XP-32 and Ubuntu Intrepid. I don't remember seeing this problem with earlier versions. This minimal example demonstrates the problem: -- import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm px = 3 rcFig = {'figsize': (1, 1), 'dpi': px, 'subplot.bottom': 0, 'subplot.left': 0, 'subplot.right': 1, 'subplot.top': 1, } plt.rc('figure', **rcFig) a = np.ones((px, px)) plt.axis('off') plt.imshow(a, cmap=cm.gray) plt.savefig('mpl_out.png', dpi=px) -- In Windows I get the correct behaviour - in this case a 3x3 image with all black pixels: bbb bbb bbb However, in Linux the leftmost column of pixels is white wbb wbb wbb By the way, I think an imsave function that just saved an array as an image with a specified colourmap and clims would be a nice addition to matplotlib.image. Is there another way to achieve the same 1-to-1 array element-to-pixel image saving applying colourmaps and clims? thanks, Gary R. - 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] different behaviour in Windows and Linux
I just realised that the example I gave may not be the best since it's not obvious what the autoscaling will do when all array values are equal. Nevertheless, even when the array contains a range of values and I use a greyscale colourmap, I'm seeing the leftmost pixel column set to all white when the array values in that column are all zeros and the image is written in Linux, whereas it's black when written in Windows. Gary - 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] different behaviour in Windows and Linux
Thanks for the rapid fix Mike. regards, Gary Michael Droettboom wrote: There is an explicit offset of one pixel on the left when it sets up a clip box in Agg. I don't know why this is there, but it dates back to 0.98.0, and earlier versions did something completely different. I can only guess it was to compensate for an earlier bug in the precise drawing of the axes rectangle. I can't explain why it would have different behavior on Windows vs. Linux, though. I have fixed this in SVN r6465 and am including a patch below (which unfortunately requires a recompile). Cheers, Mike - 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] wx backend scaling problem
Hi Michael, Michael Droettboom wrote: Well, that was a good puzzle! Glad I got your neurons firing. This seems like a safe fix to me, but anyone who currently extends the Wx Frame (meaning the whole window etc.) and is unknowingly compensating for this effect may have problems after my change. Many thanks for looking at this. I applied your fix and it works for me. Gary R. - 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
Re: [Matplotlib-users] wx backend scaling problem
Gary Ruben wrote: The attached test.py Oops. Here it is. Gary R. import matplotlib as mpl #~ mpl.use('PDF') #~ mpl.use('Agg') #~ mpl.use('TkAgg') mpl.use('WXAgg') #~ mpl.use('SVG') #~ mpl.use('PS') from pylab import * pts = 128 rcFig = {'figsize': (2,1), 'dpi': pts, 'subplot.hspace': 0.0, 'subplot.wspace': 0.0, 'subplot.bottom': 0.0, 'subplot.left': 0.0, 'subplot.right': 1.0, 'subplot.top':1.0, } rc('figure', **rcFig) subplot(121) axis('off') imshow(rand(pts,pts)) subplot(122) axis('off') imshow(tri(pts)) savefig('test',dpi=pts) - 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
Re: [Matplotlib-users] automatically choose line markers/styles?
Just an idea: Maybe you could also auto cycle between dash types if only the colour and not the dash type is specified in a plot command. The gnuplot default would be one model, or the predefined patterns in CorelDraw or Inkscape etc. Personally I don't see this as a high priority though. Gary R. - 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
Re: [Matplotlib-users] scatter plot onto background image
Hi Jibo, I'm not sure of your reasons for wanting to do this, but you might find the psychopy package of interest: http://www.psychopy.org/ Gary R. He Jibo wrote: Hi, Everyone, I want to create a scatter plot onto a background image. Anybody could help me?Thank you! The background.PNG is shown full screen with a resolution of 1024*768. The data in the fixation_xy.txt is the coordinates of eye-movement data, first column for X axis, second column for Y axis. I wish to do a scatter plot with the data onto background.PNG. Please give me a helping hand how could I do this with matplotlib. Thank you ! Jibo -- Best Regards, He Jibo [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] - 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
Re: [Matplotlib-users] pylab axis query and possible bug
Beautiful! Many thanks John. Gary R. John Hunter wrote: snip You can manually turn off autoscaling on the axes instance with the following, and both scatter and plot should then work as you want. ax1 = subplot(121) axis('off') ax1.imshow(rand(20,20)) ax2 = subplot(122) axis('off') ax2.imshow(rand(20,20)) ax1.set_autoscale_on(False) #ax1.scatter([5,10],[5,10])# note 2 ax1.plot([5,10],[5,10], 'o') # note 3 show() - 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
[Matplotlib-users] pylab axis query and possible bug
Hi listees, I often generate plots using the pylab interface plot() function to overlay an imshow() image. The minimal script below demonstrates a problem, which may be a bug, or may be a deliberate change introduced into mpl 0.91.1. It works fine with mpl 0.90.1 but gives a traceback with 0.91.1 - it seems not to be happy with the subplot limits. Commenting out the note 1 line lets it run and demonstrates my real question. With scatter(), the first subplot doesn't rescale, but if line note 2 is commented out and note 3 is uncommented, it rescales. How do I prevent the rescaling? I prefer plot() instead of scatter() in this case because of the plot origin. thanks, Gary R. -- from pylab import * rcFig = {'figsize': (2,1), 'dpi': 256, 'subplot.hspace': 0.0, 'subplot.wspace': 0.0, 'subplot.bottom': 0.0, 'subplot.left': 0.0, 'subplot.right': 1.0, 'subplot.top':1.0, } rc('figure', **rcFig)# note 1 subplot(121) axis('off') imshow(rand(20,20)) subplot(122) axis('off') imshow(rand(20,20)) subplot(121) scatter([5,10],[5,10])# note 2 #~ plot([5,10],[5,10], 'o') # note 3 show() -- - 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
[Matplotlib-users] pylab axis query and possible bug
Retrying. Sorry if this appears twice. Hi listees, I often generate plots using the pylab interface plot() function to overlay an imshow() image. The minimal script below demonstrates a problem, which may be a bug, or may be a deliberate change introduced into mpl 0.91.1. It works fine with mpl 0.90.1 but gives a traceback with 0.91.1 - it seems not to be happy with the subplot limits. Commenting out the note 1 line lets it run and demonstrates my real question. With scatter(), the first subplot doesn't rescale, but if line note 2 is commented out and note 3 is uncommented, it rescales. How do I prevent the rescaling? I prefer plot() instead of scatter() in this case because of the plot origin. thanks, Gary R. -- from pylab import * rcFig = {'figsize': (2,1), 'dpi': 256, 'subplot.hspace': 0.0, 'subplot.wspace': 0.0, 'subplot.bottom': 0.0, 'subplot.left': 0.0, 'subplot.right': 1.0, 'subplot.top':1.0, } rc('figure', **rcFig)# note 1 subplot(121) axis('off') imshow(rand(20,20)) subplot(122) axis('off') imshow(rand(20,20)) subplot(121) scatter([5,10],[5,10])# note 2 #~ plot([5,10],[5,10], 'o') # note 3 show() -- - 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] IDL Font question
IDL uses the Hershey vector fonts http://www.ifi.uio.no/it/latex-links/STORE/opt/rsi/idl/help/online_help/Hershey_Vector_Font_Samples.html The problem is that these are not trutype fonts, so the easiest solution is probably to find some free sans-serif font that looks close to Hershey on a free font site. HTH, Gary R. Jose Gomez-Dans wrote: Hi, Some colleagues have sent some plots which they generated using IDL (boo!!! hiss!! :D), and they look quite dissimilar to my matplotlib ones. I would like to mimic their layout as much as possible, which so far is a success. The only problem is that I don't know what font to use. In IDL, I believe it is called Roman (there's an smudged example here: http://www.astro.ufl.edu/~warner/IDL5220/HW4w.jpg). Does anyone know a suitable alternative? Thanks! Jose - 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] confusion about what part of numpy pylab imports
Hi Mark, this thread may help: http://thread.gmane.org/gmane.comp.python.numeric.general/13399/focus=13421 Essentially, pylab uses a compatibility layer to ease the task of supporting the three array packages - currently this uses the Numeric version of the ones and zeros functions giving the behaviour you observe - this will be fixed when pylab drops support for the older packages, which should be soon. Gary R. Mark Bakker wrote: Hello list - I am confused about the part of numpy that pylab imports. Apparently, pylab imports 'zeros', but not the 'zeros' from numpy, as it returns integers by default, rather than floats. The same holds for 'ones' and 'empty'. Example: from pylab import * zeros(3) array([0, 0, 0]) from numpy import * zeros(3) array([ 0., 0., 0.]) Can this be fixed? Any explanation how this happens? Pylab just imports part of numpy, doesn't it? Thanks, Mark - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matlab, idle, interactivity and teaching
I have to agree with Giorgio in general. Unfortunately, the threading support required by matplotlib isn't implemented in pyScripter, which means that it's a nice environment until you want to do some plotting, when it becomes a bit flaky. I haven't checked eclipse's behaviour with matplotlib. Gary R. Giorgio F. Gilestro wrote: A really great IDE for windows users is pyScripter ( http://mmm-experts.com/Products.aspx?ProductId=4 ) It's probably the best I could try so far (and it's free). cheers On 3/30/07, Tim Hirzel [EMAIL PROTECTED] wrote: As for a good IDE. I really like eclipse with pydev. For easy student/beginner setup, easyclipse has a nice python eclipse distribution http://www.easyeclipse.org/site/distributions/index.html I think I've tried near every python IDE setup out there over the last couple years, and this one wins for me. tim - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] from pylab import * imports oldnumeric
I just picked up a problem posted over on the numpy list. I noticed that from pylab import * is importing the oldnumeric-wrapper versions of zeros(), ones() and empty(), and presumably other things too, into the interactive namespace. Shouldn't it be picking up the versions from numpy's main namespace for interactive use? I picked this up because I use ipython -pylab and noticed that zeros() etc. was generating integers instead of floats by default. In ipython: Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: zeros? Type: function Base Class: type 'function' String Form:function zeros at 0x010CA3F0 Namespace: Interactive File: c:\python24\lib\site-packages\numpy\oldnumeric\functions.py Definition: zeros(shape, typecode='l', savespace=0, dtype=None) Docstring: zeros(shape, dtype=int) returns an array of the given dimensions which is initialized to all zeros In [2]: import numpy as n In [3]: n.zeros? Type: builtin_function_or_method Base Class: type 'builtin_function_or_method' String Form:built-in function zeros Namespace: Interactive Docstring: zeros((d1,...,dn),dtype=float,order='C') Return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero. -- Gary R. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with savefig and usetex
I haven't tried it, but my guess is the '\' character is the problem. pylab.xlabel('10$^3$ M$_\odot$') Try pylab.xlabel(r'10$^3$ M$_\odot$') ^ Add raw string marker. or maybe pylab.xlabel('10$^3$ M$_\\odot$') Gary R. Nicolas Champavert wrote: Hello, I have some problems when trying to save a figure with usetex=True. Sometimes, it is not possible to save the figure when trying to put an xlabel with LaTeX inside. It works with pylab.xlabel('M$_\odot$') but not with pylab.xlabel('10$^3$ M$_\odot$') (see below). Do you know why ? - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] zorder of legend
Sorry John, I see this was fixed a while ago - I was still using 0.87.3 from the last Enthought edition. Now that there's a scipy installer, I should upgrade numpy/scipy/mpl to something more current. Gary R. Gary Ruben wrote: While I think of it, I think the default zorder of legends should be bigger so that, by default it overlays all plot lines and symbols. Gary R. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] problems with vector output formats
There may be problems i.e. bugs in the eps and svg backends, as I often try (sometimes unsuccessfully) to edit these in inkscape and/or CorelDraw and sometimes, but not always, get 'badly formed eps file' messages from Corel, or spurious lines appearing in svg files in inkscape and Corel, for example. Do others get this too? A suggestion: When saving in a vector format, is it possible to remove objects totally outside the bounding box from the output files in some smart way? I guess this is currently left up to the individual backends to decide on, but perhaps implementing some filtering functions for the backends to use would encourage their use and help make output files smaller. Gary R. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] zorder of legend
While I think of it, I think the default zorder of legends should be bigger so that, by default it overlays all plot lines and symbols. Gary R. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Creating Dendrograms
Perhaps NetworkX https://networkx.lanl.gov/ will do what you want, depending on how much control you need over the node placement. There are a few more suggestions for general graph plotting solutions here: https://networkx.lanl.gov/wiki/Drawing. hth Gary R. R. Padraic Springuel wrote: Can Matplotlib create dendrograms? As best I can tell, there isn't a plotting function for doing so directly, but maybe one could make one by combining a series of commands. Has anyone done this? Does anyone know if it is possible, or if there is another package that would do the job if it isn't? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Weird resizing issue
I see weird behaviour like this in Windows too. In my case, the horizontal size of the plot window increases as the pointer is moved inside a plot region. i.e. the aspect ratio of the window changes erratically, I think between two sizes. Sometimes it remains at the incorrect shape when the mouse pointer is shifted outside the plot area and sometimes it pops back to the correct shape. Is this the behaviour you see? I don't know how to avoid it. I noticed that shifting the pointer out of the plot area by moving through the bottom of the window seems to avoid the possibility of the window remaining with the incorrect aspect. I seem to remember seeing this behaviour on an old version of matplotlib. I thought it disappeared and has perhaps returned. My memory is hazy on this. Gary R. Tommy Grav wrote: I am using matplotlib to display a couple of fits-images and then use the mouse to select a source in the image. However, when I click on the window containing the image to get it into focus the window starts resizing itself based on the movement of the mouse. I am on a mac with OS 10.4 and are using TkAgg. Has anyone seen this before and know how to avoid it from happening? Cheers Tommy - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram bug
More information on this bug: on my WinXP laptop, it seems to only manifest under some circumstances. When running the script from inside SciTE or ipython, it seems more or less repeatable (sometimes it won't show on the first run but does from then on), but if the .py file is run directly from the windows explorer, it doesn't show up. On my win98 desktop, however, it shows up regardless. Gary Ruben wrote: Note: I just verified that this was introduced into 0.87.4. 0.87.3 doesn't exhibit the problem. See attachment. Gary R. [EMAIL PROTECTED] wrote: The following minimal script reveals a rendering problem with displaying a histogram on a log vertical axis. I'm using matplotlib0.87.4 in WinXP with python 2.3.5 Enthon. from pylab import * hist(rand(100), 20, bottom=1) setp(gca(), yscale=log) show() Gary R. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram bug
Note: I just verified that this was introduced into 0.87.4. 0.87.3 doesn't exhibit the problem. See attachment. Gary R. [EMAIL PROTECTED] wrote: The following minimal script reveals a rendering problem with displaying a histogram on a log vertical axis. I'm using matplotlib0.87.4 in WinXP with python 2.3.5 Enthon. from pylab import * hist(rand(100), 20, bottom=1) setp(gca(), yscale=log) show() Gary R. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with enthon's mpl.
I tried it out and it is fixed in the latest Enthought release 1.0.0beta4 Gary Ruben wrote: Hi Rob, A couple of us reported this last week on the scipy list and I think it should be fixed in the version which was just released by Enthought, so if your friend will persevere and grab the latest version, it should be OK - I hope to try it out today. Gary R. Rob Hetland wrote: I am trying to help somebody get going on numpy/scipy/mpl. She is having trouble when starting enthon's matplotlib. She is a PC user (I am a unix/mac person), so I really don't know where to start finding the problem. Below is her note to me. Any advice would be helpful. I got the enthought python etc. distribution (dated 7/5/06) again after talking to you, and still get the same error with from pylab import * Unfortunately, I can't grab the text from the ipython shell window, but the gist is that pylab.m, tries to import Xaxis and Yaxis from axis, axis.py tries to get FontProperties from font_manager.py, which in turn looks for ft2font in matplotlib. Which is where the error message box saying entry point _ctype could not be located in the dll lib msvcr71.dll gets created. Maybe we should get another dummy tester to try it. My system has several mscvr71.dll's and it's probably choosing to use the wrong one - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with enthon's mpl.
Hi Rob, A couple of us reported this last week on the scipy list and I think it should be fixed in the version which was just released by Enthought, so if your friend will persevere and grab the latest version, it should be OK - I hope to try it out today. Gary R. Rob Hetland wrote: I am trying to help somebody get going on numpy/scipy/mpl. She is having trouble when starting enthon's matplotlib. She is a PC user (I am a unix/mac person), so I really don't know where to start finding the problem. Below is her note to me. Any advice would be helpful. I got the enthought python etc. distribution (dated 7/5/06) again after talking to you, and still get the same error with from pylab import * Unfortunately, I can't grab the text from the ipython shell window, but the gist is that pylab.m, tries to import Xaxis and Yaxis from axis, axis.py tries to get FontProperties from font_manager.py, which in turn looks for ft2font in matplotlib. Which is where the error message box saying entry point _ctype could not be located in the dll lib msvcr71.dll gets created. Maybe we should get another dummy tester to try it. My system has several mscvr71.dll's and it's probably choosing to use the wrong one - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can you set numerix in a script?
Christopher Barker wrote: To script that test, I need to be able to set numerix in a script, rather than in matplotlibrc. Can that be done? Yep, just do from pylab import * rcParams['numerix'] = 'numpy' While we're at it, it would be great if ANY of the config items in matplotlibrc could, instead, be set at run time in a script. I now a number of them can, but is there a standard way to do, and will it work with ALL the items in there? rcParams is the standard way and I think works for all items. Another note: it seems that numerix is very good at taking input from any of the Num* packages, regardless of which one is being used internally. Given that, I'm thinking of aiming for the future with my OS-X package, and just using numpy, and not bothering to build in support for the other two. any thoughts. -Chris If I was developing something now, I would only bother supporting numpy. Gary R. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Improved dashing for black and white plots?
On this topic, here is something I used the other day (just some different dash sequences): e, = plot(x, y, 'k', label=r'$\theta_3=%1.2f$'%(th3)) setp(e, dashes={0:(1,0), 1:(2,2), 2:(10,4), 3:(10,4,4,4), 4:(10,2,2,2), 5:(15,2,6,2)}[i]) Maybe we should just blatantly copy the gnuplot sequence, although the sequence might be gpl'ed! One question which arises is that it wasn't clear what to set dashes to to get a solid line. I ended up doing the 0: case above i.e. (1,0), but I suspect this isn't ideal because it might generate lots of unwanted line segments. I think I tried None and (1) and it didn't work. Perhaps (999,0) would be better? Gary R. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users