Hi Alan, Alan G Isaac wrote: > This is a second plea for help. > http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg12632.html > > I have a figure.Figure embedded in a FigureCanvasTkAgg. > Each iteration, new data are received, > and I want an updated histogram. > > Now I can at least see a way to do this with pyplot: > I just clear my axes each iteration, call ax.hist, > and then call plot.draw(). I think (?) my problem > is finding an equivalent to plt.draw() in the object > oriented interface. > > What I'd really like to do each iteration is change > only the heights of the rectangles. >
I don't do fancy stuff like embedding figures in GUIs, but assuming things work the same way regardless: have you tried grabbing the object handles from hist (which are patches) and using the rectangle patch functions (http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Rectangle) e.g. set_height() to change the rectangles? e.g. code ------------------------------ import pylab x = pylab.rand(20) h = pylab.hist(x) h[2][0].set_height(1) pylab.draw() -------------------------------- h is a tuple with the last element as a list of patch objects In [82]: h Out[82]: (array([3, 3, 2, 1, 3, 0, 0, 1, 3, 4]), array([ 0.02262869, 0.11966418, 0.21669968, 0.31373517, 0.41077066, 0.50780615, 0.60484164, 0.70187713, 0.79891263, 0.89594812, 0.99298361]), <a list of 10 Patch objects>) Best -Kaushik ------------------------------------------------------------------------------ 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