Re: [Matplotlib-users] exclude something from legend
Hi Carlos, On Thu, Aug 26, 2010 at 04:49, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hello all, Is there a way to tell MPL that something I plotted (like a series of Line2D, to create a grid) should not be considered for the legend? I'm plotting a lot of things, and because of these objects (without label), I always got these msgs: /usr/lib/pymodules/python2.6/matplotlib/axes.py:4014: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots. warnings.warn(No labeled objects found. I always use the following set of commands to get costumize my legend: ** legendEntries=[] # list of plots that are going to be in the legend legendText=[] # list of text messages for the legend thisPlot = plot(x,y,'b*') # a plot command legendEntries.append(thisPlot) # only do this for the plots you want to add to the legend legendText.append(legend text)# only this for the plots you want to add to the legend lgd = legend(legendEntries,legendText,numpoints=1,prop=props,loc='upper right') # example of how to draw the legend ** Hope this helps, Tinne -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] My Legend keeps growing! Help
Hi , On Thu, Aug 26, 2010 at 05:47, dcarroll spanishcastlema...@gmail.com wrote: I am trying make a plot that is in a loop and replots when new data is updated. #IN A LOOP fig = plt.figure(1,[10,10]) fig.clf prop = matplotlib.font_manager.FontProperties(size=8) xMin = dates[1] xMax = dates[-1] #temperature plot yMin = min(temperatureSQLData) yMax = max(temperatureSQLData) minTemperature = Min = %.3f % min(temperatureSQLData) + 'deg ' + 'C' minTemperatureIndex = temperatureSQLData.index(yMin) maxTemperature = Max = %.3f % max(temperatureSQLData) + 'deg ' + 'C' maxTemperatureIndex = temperatureSQLData.index(yMax) ax1 = fig.add_subplot(511) ax1.cla plt.hold(True) plt.plot(dates,temperatureSQLData,'r') plt.plot(dates[minTemperatureIndex],yMin,'ro',label=minTemperature) plt.plot(dates[maxTemperatureIndex],yMax,'bo',label=maxTemperature) plt.hold(False) plt.title(Water Conditions for the last 7 Days.) plt.xlim([xMin,xMax]) plt.ylim([yMin-1,yMax+1]) plt.ylabel('Temperature') ax1.legend(numpoints=1,prop=prop) dateFormat = mpl.dates.DateFormatter('%m/%d/%Y') ax1.xaxis.set_major_formatter(dateFormat) daysLocation = mpl.dates.DayLocator() ax1.xaxis.set_major_locator(daysLocation) hoursLocation = mpl.dates.HourLocator(interval=4) ax1.xaxis.set_minor_locator(hoursLocation) The problem is that the number of items in my legend grows with each iteration of the loop. Any help would be appreciated! You can select yourself what you want to include in the legend by creating the legend as follows: ** legendEntries=[] # list of plots that are going to be in the legend legendText=[] # list of text messages for the legend thisPlot = plot(x,y,'b*') # a plot command legendEntries.append(thisPlot) # only do this for the plots you want to add to the legend legendText.append(legend text)# only this for the plots you want to add to the legend lgd = legend(legendEntries,legendText,numpoints=1,prop=props,loc='upper right') # example of how to draw the legend ** so you could clean the legendEntries and legendText at the beginning of every loop by calling legendEntries=[] legendText=[] Or if the legend is every time the same you can only create it in the first iteration of the loop and then do not change the legendEntries or legendtext any more. Tinne -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting open symbols
Hi Jonathan, On Fri, Aug 20, 2010 at 16:29, Jonathan Slavin jsla...@cfa.harvard.edu wrote: To all: I'm wondering if there is any way to make plots with open symbols, e.g. a circle. I know how to use markers that look open, e.g. by doing something like, plot(x,y,marker='o',mfc='w') They are white in the center, but they're not really open since they block out whatever is behind them. I tried using a color with transparency, say alpha=0.1 or something (mfc=(1.,1.,1.,0.1)) but that didn't work. What I have in mind is illustrated in the attached plot, which I made some time ago in IDL. Is there an easy way to define your own markers for plotting? just use mfc='None' Tinne -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Drawing Error Ellipses
On Wed, Oct 28, 2009 at 9:06 AM, Eero Nevalainen eero.nevalai...@indagon.com wrote: Hi, I need to draw error ellipses on a scatterplot. I'm guessing someone has done this before. I've found some examples, such as this one http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_rotated.html That led to the artist tutorial, and... ARGH! INFORMATION OVERFLOW! Can someone explain to me, why I suddenly have to know so much about matplotlib's internals to get an ellipse drawn? Hi, I just made a function to draw uncertainty ellipses defined by a covariance matrix P: def plotEllipse(pos,P,edge,face): U, s , Vh = svd(P) orient = math.atan2(U[1,0],U[0,0]) ellipsePlot = Ellipse(xy=pos, width=math.sqrt(s[0]), height=math.sqrt(s[1]), angle=orient,facecolor=face, edgecolor=edge) ax = gca() ax.add_patch(ellipsePlot); show() return ellipsePlot To use it: ellipsePlot=plotEllipse([x,y],P,'black','0.3') Hope this helps, Tinne -- 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] Axes3D - Equal Aspect Ratio
Hi Thomas,. I'm playing around with mpl_toolkits.mplot3d to represent a 3D scatter, but I need the axis' aspect to be 'equal'. I tried to : ax = Axes3D(fig) ax.set_aspect('equal') axis(scaled) worked for me. Tinne -- 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