Thanks for the reply. The trick with clf() is that it redraws the entire image, and hold(False), while much better, changes the axes values. Ideally I could keep my axes setup and redraw only the bars, ala the animation example of the plot() sine wave. Looking at that code, I'm trying something like:

line, = bar(i + 0.25 , name_value_dict[key], color='red'), and calling line.set_y(), but with similar issues.

Any other pointers would be greatly appreciated.


On Sun, Jun 22, 2008 at 2:54 PM, Ryan May <> wrote:
Matt C wrote:
I'm very new to MPL, and I'm having a blast with it - great work.  I've looked around  the docs, lists and  other  random places for a hint on this, but I'm still stumped.

The goal is simple: I'd like to create a very basic animated bar or barh chart. I've been playing via ion() from the IPython shell but I run into the following issue: The bar is painted correctly, but any value lower than the max doesn't show up, as the max value bar doesn't clear. For example, from IPython:

bar(10+0.25, 10) shows perfectly, then an update (using interactive mode set to on)
bar(10+0.25, 4)

Try adding a clf(), which clears the current figure, in between the calls to bar.  Another option is to use hold(False) signals that you want a new plotting command to start from a clean slate.


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma