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! -- View this message in context: http://old.nabble.com/My-Legend-keeps-growing%21-Help-tp29538626p29538626.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ 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