removing a colorbar

Fl?vio> hi, how can I remove a colorbar?

    Fl?vio> in the following code, i generate figures that are saved
    Fl?vio> not shown. and with every new figure I get an extra
    Fl?vio> colorbar instead of an updated one!

Hi Flavio,

Try clearing the figure between saves with clf. Or else manage the
different figures the "figure" and "close" commands.

The default mode of matplotlib is to continue adding stuff to the same
figure, so you need to clear axes with "cla", clear figures with
"clf", close figures with "close", create new figures with "figure",
and manage the hold state with "hold", "ion", "ioff" and "ishold".
See the documentation for all of these commands at
http://matplotlib.sf.net/matplotlib.pylab.html

Hope this helps,
JDH

Thanks John,

I just want to let you know that neither 'cla', 'clf' nor 'figure' solved the
issue but 'close' did it. I must point out that the only element that was
being carried out from figure to figure was the colorbar, not the plot
itself. Apparently 'close' is the only one of these functions that gets rid
of the colorbar.

Flávio

···

On Saturday 12 February 2005 23:40, John Hunter wrote:

    > hi, how can I remove a colorbar?

    > in the following code, i generate figures that are saved
    > not shown. and with every new figure I get an extra
    > colorbar instead of an updated one!

Hi Flavio,

Try clearing the figure between saves with clf. Or else manage the
different figures the "figure" and "close" commands.

The default mode of matplotlib is to continue adding stuff to the same
figure, so you need to clear axes with "cla", clear figures with
"clf", close figures with "close", create new figures with "figure",
and manage the hold state with "hold", "ion", "ioff" and "ishold".
See the documentation for all of these commands at
http://matplotlib.sf.net/matplotlib.pylab.html

Hope this helps,
JDH