Re: [Matplotlib-users] Plotting histograms with zero counts
Yang Zhang wrote: Hi, when I do: hist([0,0,0], bins=10, range=(0,10)) How come the single bin takes up the entire plot? Same with just two values, or anything less than 10 - the two bars take up the entire plot, no matter what I plug in for range. I'd just like 10 bins, from 0 to 9. That's a bug in the current implementation (see also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503148). mm - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting histograms with zero counts
Manuel Metz wrote: Yang Zhang wrote: Hi, when I do: hist([0,0,0], bins=10, range=(0,10)) How come the single bin takes up the entire plot? Same with just two values, or anything less than 10 - the two bars take up the entire plot, no matter what I plug in for range. I'd just like 10 bins, from 0 to 9. That's a bug in the current implementation (see also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503148). This is fixed now on the trunk. mm - 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] Save a plot background
Any chance of further help? John? Hrafnkell -- View this message in context: http://www.nabble.com/Save-a-plot-background-tp20519596p20771515.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Make markers in legend to appear only once
Hi: I am plotting using markers, in a similar way than this example: http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo2.html As you can see in the example above, the markers in the legend appear twice: 'green circle' 'green circle' oscillatory. Is it possible to make the markers to appear only once, like 'green circle' oscillatory ? Regards, Alejandro. - 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] plot_date - extra values added that are not inmy data
Hi, I'm also new to matplotlib and am still wrestling with my figures Have you tried: axis('tight') but that will also affect the yaxis. Or: set_xlim(valmin, valmax) Don't know if it works with date though. Good luck! Sünnje -Original Message- From: Richard Martin [mailto:[EMAIL PROTECTED] Sent: Sun 11/30/2008 22:06 To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] plot_date - extra values added that are not inmy data Hello, I have been wrestling with matplotlib all evening (im completely new to it since a few hours ago) and finally almost have my graph finished. There is just one thing left that I can't seem to figure out myself. I have attached the graph for reference (hope attachments are allowed). It is a date plot, my data starts at 16:58:11 and ends at 17:25:14 but for some reason I am being given ticks for a few minutes before and a few minutes after. Is there some kind of compress, or trim function that I can use to get rid of these and have the axis start at my first data point and end at my last. Or at least the nearest major tick? Cheers - 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] Make markers in legend to appear only once
Alejandro Weinstein wrote: Hi: I am plotting using markers, in a similar way than this example: http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo2.html As you can see in the example above, the markers in the legend appear twice: 'green circle' 'green circle' oscillatory. Is it possible to make the markers to appear only once, like 'green circle' oscillatory ? You can use the keyword numpoints in the legend method: legend( (l2, l4), ('oscillatory', 'damped'), 'upper right', shadow=True, numpoints=1) should do the job. mm Regards, Alejandro. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Make markers in legend to appear only once
On Mon, Dec 1, 2008 at 7:13 AM, Manuel Metz [EMAIL PROTECTED] wrote: You can use the keyword numpoints in the legend method: Thank you! It did the trick. Now how you conclude that from the documentation is a mystery: From the docs: numpoints: integer The number of points in the legend line, default is 4 Regards, Alejandro. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot with drop shadow
Is there a way to plot lines with drop shadows? Thanks, Nate - 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] Make markers in legend to appear only once
Alejandro Weinstein wrote: On Mon, Dec 1, 2008 at 7:13 AM, Manuel Metz [EMAIL PROTECTED] wrote: You can use the keyword numpoints in the legend method: Thank you! It did the trick. Now how you conclude that from the documentation is a mystery: From the docs: numpoints: integer The number of points in the legend line, default is 4 Ah, that's apparently a bug in the docs, which I've fixed in the sources. Regards, Alejandro. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with drop shadow
On Mon, Dec 1, 2008 at 9:17 AM, Nate [EMAIL PROTECTED] wrote: Is there a way to plot lines with drop shadows? Nothing built-in -- but you can fake it:: import matplotlib.pyplot as plt import numpy as np t = np.arange(0.0, 2.0, 0.01) s = np.sin(2*np.pi*t) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(t+0.01, s-0.01, color='gray', lw=2) ax.plot(t, s, color='blue', lw=3) plt.show() JDH - 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] Save a plot background
Hrafnkell Pálsson wrote: Any chance of further help? John? Hrafnkell Hrafnkell: I'm pretty sure this is a fundamental limitation of canvas.restore_region - everything gets draw on top of it. If I recall correctly, you'd like to save the map with coastlines drawn, and just redraw contours on it. If you're reusing a Basemap instance, I'd be surprised if the time spent redrawing the coastlines is all that significant. Are you? Creating the coastline polygons in map projection coordinates is the most expensive operation, but that is done when the Basemap instance is created. Another option would be to just remove the contours from the figure, then redraw the new ones and re-save the figure, i.e. from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt # create new figure fig=plt.figure() # setup of of mollweide Basemap. m = Basemap(resolution='c',projection='moll',lon_0=0) # draw some contours. x, y = m(lons, lats) # get map projection coords of lat/lon grid CS = m.contour(x,y,data,15,linewidths=0.5,colors='k') # draw coastlines and projection limb. m.drawcoastlines() m.drawmapboundary() # save figure with contours. plt.savefig('fig1.png') # remove contours, save figure again. for coll in CS.collections: coll.remove() plt.savefig('fig2.png') # draw contours again, this time red, save figure a third time. CS = m.contour(x,y,data,15,linewidths=0.5,colors='r') plt.savefig('fig3.png') HTH, -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
I found bug number 1859027 and have appended the below to the bug report. When is the next release due and how likely is this to get fixed? I might have time myself to help in a week or so, but would appreciate some help if someone else has time too (who has looked at the source before...) Thanks, Matt From: Fago, Matt - AES Sent: Tuesday, November 25, 2008 1:04 PM To: matplotlib-users@lists.sourceforge.net Subject: Matplotlib PSD bug? [I'm not sure if this is best in 'devel' or 'users'] I'm trying to compute PSDs using matplotlib.mlab.psd and came across the PSD amplitudes thread from last year: http://sourceforge.net/mailarchive/message.php?msg_id=472101A6.9080206%40isla.hawaii.edu Using the latest version of psd on svn trunk (rev 6429) that added support for pad_to, I can now compute the Matlab pwelch example using matplotlib. This example is given in the Signal Processing Toolbox User's Guide: http://www.mathworks.com/access/helpdesk/help/pdf_doc/signal/signal_tb.pdf (look on pages 2-23 and 2-24). Note I do not have easy access to Matlab itself, so I'm just using this published example. The Matlab code is as follows: randn('state',1) fs = 1000; % Sampling frequency t = (0:0.3*fs)./fs;% 301 samples A = [2 8]; % Sinusoid amplitudes (row vector) f = [150;140]; % Sinusoid frequencies (column vector) xn = A*sin(2*pi*f*t) + 5*randn(size(t)); Hs = spectrum.welch('rectangular',150,50); psd(Hs,xn,'Fs',fs,'NFFT',512); This produces a fairly noisy signal from -20 to -10 dB, with a strong peak of ~6 dB at 150 Hz (see the plot on page 2-24). While my equivalent (?) python code is: from scipy import * from mlabsvn import psd # This is a local copy of svn revision 6429 of matplotlib.mlab from pylab import * fs=1000 t=linspace(0,0.3,0.3*fs+1) A=[2,8] f=[150,140] xn=A[0]*sin(2*pi*f[0]*t) + A[1]*sin(2*pi*f[1]*t) + 5*randn(len(t)) Pxx,freqs = psd(xn,Fs=fs,NFFT=150,noverlap=75,pad_to=512) figure() plot(freqs, 10*log10(Pxx) ) show() However, this produces a peak of over 30 dB at 150 Hz. Unless there is a mistake in my code above, there seems to be a significant difference between the matplotlib and matlab implementations. I noticed that the values 10*log10(Pxx/len(xn)) produces results that match much better. Without looking more closely at the code for psd and reviewing Bendat and Piersol I cannot be sure that this is the correct fix. Does anyone else have any insight? When is the next release planned, and how likely is a fix? Thanks, Matt This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting edges between nodes
Mauro Cavalcanti wrote: The above code works quite well. However, I do *not* want to have the plot done for each edge inside the for loop; instead, I would like to have the x,y points stored for being plotted at once, using a plot command issued outside the loop. It seems that it could be done using MPL line collections, but I could not figure out how to do this. Any hints? You can plot the columns of a X/Y data using one plot command here: from pylab import * nodes = load('nodes.dat') edges = int16(load('edges.dat')) - 1 x = nodes[edges,0].transpose() y = nodes[edges,1].transpose() plot(x,y,'-bo') show() -- View this message in context: http://www.nabble.com/Plotting-edges-between-nodes-tp20708135p20774488.html Sent from the matplotlib - users mailing list archive at Nabble.com. - 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] Make markers in legend to appear only once
Manuel Metz wrote: Alejandro Weinstein wrote: On Mon, Dec 1, 2008 at 7:13 AM, Manuel Metz [EMAIL PROTECTED] wrote: You can use the keyword numpoints in the legend method: Thank you! It did the trick. Now how you conclude that from the documentation is a mystery: From the docs: numpoints: integer The number of points in the legend line, default is 4 Ah, that's apparently a bug in the docs, which I've fixed in the sources. I have to correct myself. John Hunter applied a patch which fixed the docs. Regards, Alejandro. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
Fago, Matt - AES wrote: I found bug number 1859027 and have appended the below to the bug report. When is the next release due and how likely is this to get fixed? I might have time myself to help in a week or so, but would appreciate some help if someone else has time too (who has looked at the source before...) I'm sitting down to look at this right now. Can you tell me if you have this problem with 0.98.3 as well? Thanks, Ryan Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
Ryan May wrote: Fago, Matt - AES wrote: I found bug number 1859027 and have appended the below to the bug report. When is the next release due and how likely is this to get fixed? I might have time myself to help in a week or so, but would appreciate some help if someone else has time too (who has looked at the source before...) I'm sitting down to look at this right now. Can you tell me if you have this problem with 0.98.3 as well? Nevermind, I just realized you can't really do the example without the new support for pad_to. I'm still looking... Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pylab or not... crashes or not
Hi this may be a known problem (didn't find anything on this issue) but here it is: - when I start a session with ipython -pylab I often get crashes with my session. When I mean often, it means really often like once everything 1/2h or so. A crash means that the command I just sent gets stuck and the only way for me to get it back is to kill the PID of the ipython process... The problem is that it is almost impossible to reproduce a systematic behaviour there so I cannot really send you a list of commands which results in a crash. It just happens (often). However, after someone suggested it, I now enter Ipython by a simple ipython and do immediately from pylab import *. And then I have NO crashes whatsoever. any suggestion there? Is that normal? thanks Eric P.S.: OpenSuse 11.0 or 10.3 (two machines showing similar behaviour) matplotlib version 0.98.3 verbose.level helpful interactive is True units is True platform is linux2 backend GTKAgg version 2.10.6 Python 2.5.1 (r251:54863, Aug 1 2008, 00:35:20) IPython 0.8.1 -- An enhanced Interactive Python. - 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] Font sizes for web application
Jesper Larsen wrote: I have a web application in which I would like to scale the plots down if the users horizontal screen size is less than 800. http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - 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] Ovality of a perturbed circular path
On Wed, Nov 26, 2008 at 7:11 AM, Nils Wagner [EMAIL PROTECTED] wrote: Hi all, I would like to visualize the ovality of a perturbed circular path by a polar plot. How can I improve the view wrt to scaling and ticks ? Is: from pylab import ylim, ytics figure(2) polar(theta,(r+noise)/r) ylim(0, 2) yticks(arange(0, 2, 0.25)) show() The kind of thing you're after? Cheers, Matt -- Matt Foster | http://hackerific.net - 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] pylab or not... crashes or not
On Mon, Dec 1, 2008 at 1:08 PM, Eric Emsellem [EMAIL PROTECTED] wrote: Hi this may be a known problem (didn't find anything on this issue) but here it is: - when I start a session with ipython -pylab I often get crashes with my session. When I mean often, it means really often like once everything 1/2h or so. A crash means that the command I just sent gets stuck and the only way for me to get it back is to kill the PID of the ipython process... The problem is that it is almost impossible to reproduce a systematic behaviour there so I cannot really send you a list of commands which results in a crash. It just happens (often). However, after someone suggested it, I now enter Ipython by a simple ipython and do immediately from pylab import *. And then I have NO crashes whatsoever. any suggestion there? Is that normal? It is definitely not normal -- it almost never happens to me. Does it help if you run TkAgg instead of GTKAgg. Are you importing/using anything else when this is happening? What version of numpy are you running? - 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] plot with drop shadow
John Hunter-4 wrote: On Mon, Dec 1, 2008 at 9:17 AM, Nate [EMAIL PROTECTED] wrote: Is there a way to plot lines with drop shadows? Nothing built-in -- but you can fake it:: import matplotlib.pyplot as plt import numpy as np t = np.arange(0.0, 2.0, 0.01) s = np.sin(2*np.pi*t) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(t+0.01, s-0.01, color='gray', lw=2) ax.plot(t, s, color='blue', lw=3) plt.show() JDH So there is no way to say plot a line. Grab that image. Apply a standard SVG filter (like Gaussian). And overlay the blur? I do not know the PIL well enough to know if this is feasible. -- View this message in context: http://www.nabble.com/plot-with-drop-shadow-tp20773979p20780129.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
Fago, Matt - AES wrote: I cannot really compute the example without the pad_to support in svn. Nevertheless, using something similar (nfft=128, noffset=64) gives similarly erroneous results. Did you add 'pad_to'? If so, thanks! Good to know. I recently (within the last month) did a bunch of work on psd, based in a large part on work done by one of my colleagues, Sean Arms. I was worried some of this had broken existing code, but it appears more likely that this was already a problem. After much playing, and reading the Matlab docs, it looks like the difference is that Matlab normalizes by the sampling frequency. Also, if a one-sided psd is returned, it multiplies everything by 2. If I apply these two scaling factors, I get results in line with those produced by Matlab. Now, this scaling was not performed by the old code, so this is not a new incompatibility (bug?) with Matlab. Also, while I have not reviewed the reference specified in the docstring (Bendat and Piersol 1986), the book I have handy (Stoica and Moses 2005) does not mention scaling by the sampling frequency, nor does the included Matlab code perform any such scaling. So what should be done here? I would be opposed to making such scaling the default, as IMHO it tries to do too much and I would have to work around it to get the more raw numbers. However, I am not opposed to adding (yet another) option to do such scaling. Other opinions? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma - 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] plot with drop shadow
Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? twentypoundtrout [EMAIL PROTECTED] 12/01/08 01:43 PM To matplotlib-users@lists.sourceforge.net cc Subject Re: [Matplotlib-users] plot with drop shadow John Hunter-4 wrote: On Mon, Dec 1, 2008 at 9:17 AM, Nate [EMAIL PROTECTED] wrote: Is there a way to plot lines with drop shadows? Nothing built-in -- but you can fake it:: import matplotlib.pyplot as plt import numpy as np t = np.arange(0.0, 2.0, 0.01) s = np.sin(2*np.pi*t) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(t+0.01, s-0.01, color='gray', lw=2) ax.plot(t, s, color='blue', lw=3) plt.show() JDH So there is no way to say plot a line. Grab that image. Apply a standard SVG filter (like Gaussian). And overlay the blur? I do not know the PIL well enough to know if this is feasible. -- View this message in context: http://www.nabble.com/plot-with-drop-shadow-tp20773979p20780129.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with drop shadow
Mike Hearne wrote: Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? Out of curiosity, what is the payoff (in communication or aesthetics) of such a thing? Thanks, Alan Isaac - 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] plot with drop shadow
On Mon, Dec 1, 2008 at 2:43 PM, twentypoundtrout [EMAIL PROTECTED] wrote: So there is no way to say plot a line. Grab that image. Apply a standard SVG filter (like Gaussian). And overlay the blur? I do not know the PIL well enough to know if this is feasible. You can do this using an external program -- see for example http://abitofpythonabitofastronomy.blogspot.com/2008/10/svg.html. It would be challenging to implement something like this internally across output formats I think, but we recently added some features to make it easier to use an svg editor for filtering mpl objects. See also this thread http://www.nabble.com/SVG-clickable-images-td20236869.html#a20236869 JDH - 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] plot with drop shadow
Alan G Isaac wrote: Mike Hearne wrote: Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? Out of curiosity, what is the payoff (in communication or aesthetics) of such a thing? I don't think that it communicates any more information, but it can often add depth to an otherwise benign figure and can also make the presentation softer to view. Just makes if fancy I guess. -- View this message in context: http://www.nabble.com/plot-with-drop-shadow-tp20773979p20781124.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
Ryan May wrote: Fago, Matt - AES wrote: I cannot really compute the example without the pad_to support in svn. Nevertheless, using something similar (nfft=128, noffset=64) gives similarly erroneous results. Did you add 'pad_to'? If so, thanks! Good to know. I recently (within the last month) did a bunch of work on psd, based in a large part on work done by one of my colleagues, Sean Arms. I was worried some of this had broken existing code, but it appears more likely that this was already a problem. After much playing, and reading the Matlab docs, it looks like the difference is that Matlab normalizes by the sampling frequency. Also, if a one-sided psd is returned, it multiplies everything by 2. If I apply these two scaling factors, I get results in line with those produced by Matlab. Now, this scaling was not performed by the old code, so this is not a new incompatibility (bug?) with Matlab. Also, while I have not reviewed the reference specified in the docstring (Bendat and Piersol 1986), the book I have handy (Stoica and Moses 2005) does not mention scaling by the sampling frequency, nor does the included Matlab code perform any such scaling. So what should be done here? I would be opposed to making such scaling the default, as IMHO it tries to do too much and I would have to work around it to get the more raw numbers. However, I am not opposed to adding (yet another) option to do such scaling. Hi Ryan, I appreciate the work you're doing on this, and while I don't have any very strong opinions on the API questions you raise, I would request that you include in the docstrings information at least at the level of the above, listing the scaling issue, the sources you've followed and how and why you've chosen to follow them or deviate, and differences with the default behavior of other software. I recently helped a colleague use Matlab's PSD/pwelch functions and had to spend some time sending in sine waves of various frequencies and amplitudes to figure out what the results meant. If matplotlib gives different results by default, I think it should 1) justify why and 2) indicate what option(s) may be set to get results equivalent to other systems, including Matlab. Thanks again, Andrew - 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] Toggling points and legends
Mauro Cavalcanti wrote: Dear ALL, Is there any example of toggling points on and off a MPL Basemap? I see that there matplotlib artists have a handy set_visible() method, but if I have a map with plotted points and use ax.set_visible(False), the entire map is made invisible! Sorry this took so long, I lost you in my queue. You need to first save the results of the command you use to plot the points (every plotting command returns an object or set of objects that represent what was added to the plot.). You then call set_visible() on this object. Your problem was that calling ax.set_visible(False) made the entire Axes object invisible, which, as you saw, hid the plot. Here's a modified version of the plotcities example: from mpl_toolkits.basemap import Basemap as Basemap m = Basemap() x, y = [70,30,110,-97,75,-10], [35, 40, 45, 60, -10, -40] x,y = m(x,y) m.drawcoastlines() m.fillcontinents() pts = m.scatter(x,y,25,marker='o',edgecolors='none',zorder=10) pts.set_visible(False) #Uncomment to make visible plt.show() Hope this helps, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
On Mon, Dec 1, 2008 at 3:40 PM, Andrew Straw [EMAIL PROTECTED] wrote: I appreciate the work you're doing on this, and while I don't have any very strong opinions on the API questions you raise, I would request that you include in the docstrings information at least at the level of the above, listing the scaling issue, the sources you've followed and how and why you've chosen to follow them or deviate, and differences with the default behavior of other software. I recently helped a colleague use Matlab's PSD/pwelch functions and had to spend some time sending in sine waves of various frequencies and amplitudes to figure out what the results meant. If matplotlib gives different results by default, I think it should 1) justify why and 2) indicate what option(s) may be set to get results equivalent to other systems, including Matlab. My preference is to strive for matlab compatability here. I am pretty sure it was compatible with matlab in my original tests to several significant digits, but I no longer have the test code and my memory is fuzzy because it was over 5 years ago. But I intended this function to be matlab compatible, and if it is not I would prefer to see it compatible even if it means breaking some existing code. It is possible that the original code did not scale with sampling frequency and was compatible, but over time we've made enhancements that broke compatibility. Its been a long time since I used and tested against matlab. If there is good reason to add support for an alternate scaling, we can easily support it with kwargs. But since the signature and origins of this function were matlab compatibility, I think it is least confusing if the default output has similar scaling. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
I suppose the issue is: what is correct? Or is it a matter of definition? I don't have Stoica and Moses, but Bendat and Piersol eqn 11.102: One_Sided_PSD = 2/(n_d * N * dt) * Sum(FFT^2) where there are n_d is the number of averages and N is the number of points in the FFT. That seems to be scaling by the length? I'm fairly certain that the factor of two (as shown above) is required for a one-sided PSD, as that comes from 'removing' the negative frequency range. Note that Matlab shows such scaling (by 2/L) even when computing the power spectra directly from a raw (unaveraged) FFT: http://www.mathworks.com/support/tech-notes/1700/1702.html To me, as Matplotlib is striving to be Matlab-compatible, the default behaviour should be to give results as close to the Matlab implementation as possible. One could always have an option to turn off the scaling. Note that the Matplotlib results also seem to have significantly less frequency resolution than the Matlab results. Is this the case, or am I not using noffset, nfft, and pad_to correctly? Thanks for your help, Matt From: Ryan May [EMAIL PROTECTED] Sent: Monday, December 01, 2008 1:58 PM To: Fago, Matt - AES Cc: Matplotlib Users Subject: Re: [Matplotlib-users] Matplotlib PSD bug? Fago, Matt - AES wrote: I cannot really compute the example without the pad_to support in svn. Nevertheless, using something similar (nfft=128, noffset=64) gives similarly erroneous results. Did you add 'pad_to'? If so, thanks! Good to know. I recently (within the last month) did a bunch of work on psd, based in a large part on work done by one of my colleagues, Sean Arms. I was worried some of this had broken existing code, but it appears more likely that this was already a problem. After much playing, and reading the Matlab docs, it looks like the difference is that Matlab normalizes by the sampling frequency. Also, if a one-sided psd is returned, it multiplies everything by 2. If I apply these two scaling factors, I get results in line with those produced by Matlab. Now, this scaling was not performed by the old code, so this is not a new incompatibility (bug?) with Matlab. Also, while I have not reviewed the reference specified in the docstring (Bendat and Piersol 1986), the book I have handy (Stoica and Moses 2005) does not mention scaling by the sampling frequency, nor does the included Matlab code perform any such scaling. So what should be done here? I would be opposed to making such scaling the default, as IMHO it tries to do too much and I would have to work around it to get the more raw numbers. However, I am not opposed to adding (yet another) option to do such scaling. Other opinions? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. - 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] pylab or not... crashes or not
John Hunter wrote: On Mon, Dec 1, 2008 at 1:08 PM, Eric Emsellem [EMAIL PROTECTED] wrote: Hi this may be a known problem (didn't find anything on this issue) but here it is: - when I start a session with ipython -pylab I often get crashes with my session. When I mean often, it means really often like once everything 1/2h or so. A crash means that the command I just sent gets stuck and the only way for me to get it back is to kill the PID of the ipython process... The problem is that it is almost impossible to reproduce a systematic behaviour there so I cannot really send you a list of commands which results in a crash. It just happens (often). However, after someone suggested it, I now enter Ipython by a simple ipython and do immediately from pylab import *. And then I have NO crashes whatsoever. any suggestion there? Is that normal? It is definitely not normal -- it almost never happens to me. Does it help if you run TkAgg instead of GTKAgg. Are you importing/using anything else when this is happening? What version of numpy are you running? Well I never use ipython -pylab and always use tkagg. It could be a race in the way ipython manage to do that: http://ipython.scipy.org/moin/Cookbook/InterruptingThreads What version of ipython are you using? Xavier - 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] Toggling points and legends
Dear Ryan, Thank your very much for your kind reply. I had already a couple of solutions to that problem, and your adds nicely to them! I am very grateful to everyone who have been so helpful and can assure you will also be formally acknowledged at the conclusion of this project. With warmest regards, 2008/12/1 Ryan May [EMAIL PROTECTED]: Mauro Cavalcanti wrote: Dear ALL, Is there any example of toggling points on and off a MPL Basemap? I see that there matplotlib artists have a handy set_visible() method, but if I have a map with plotted points and use ax.set_visible(False), the entire map is made invisible! Sorry this took so long, I lost you in my queue. You need to first save the results of the command you use to plot the points (every plotting command returns an object or set of objects that represent what was added to the plot.). You then call set_visible() on this object. Your problem was that calling ax.set_visible(False) made the entire Axes object invisible, which, as you saw, hid the plot. Here's a modified version of the plotcities example: from mpl_toolkits.basemap import Basemap as Basemap m = Basemap() x, y = [70,30,110,-97,75,-10], [35, 40, 45, 60, -10, -40] x,y = m(x,y) m.drawcoastlines() m.fillcontinents() pts = m.scatter(x,y,25,marker='o',edgecolors='none',zorder=10) pts.set_visible(False) #Uncomment to make visible plt.show() Hope this helps, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: [EMAIL PROTECTED] Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 Life is complex. It consists of real and imaginary parts. - 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] plot with drop shadow
The long answer is: I have a map with a varying background. I'd like to be able to create a white drop-shadow behind darker text, so that the text can stand out reasonably clearly against most colored backgrounds. The short answer is that my customers want it. --Mike Alan G Isaac [EMAIL PROTECTED] 12/01/08 02:25 PM To matplotlib-users@lists.sourceforge.net cc Subject Re: [Matplotlib-users] plot with drop shadow Mike Hearne wrote: Along similar lines, has anyone figured out a way to have a drop shadow effect for text on a plot? Out of curiosity, what is the payoff (in communication or aesthetics) of such a thing? Thanks, Alan Isaac - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with drop shadow
On 12/1/2008 7:27 PM Mike Hearne apparently wrote: The long answer is: I have a map with a varying background. I'd like to be able to create a white drop-shadow behind darker text, so that the text can stand out reasonably clearly against most colored backgrounds. OK. I can imagine this. If I wanted a quick pass at a cheap substitute for that kind of effect in PostScript, I'd probably stroke the text outline in white and then fill in the dark color. Do not know if that is possible in mpl or desirable for you. The short answer is that my customers want it. Reason enough. Thanks, Alan - 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