clearing a figure

Belinda -

The hold state is on by default when you use pylab. To clear a figure you use clf().
Here’s a brief example:
from pylab import *
figure() # Not really needed, you could have typed plot right away, but here you can set some nice features like the size

plot([2,1,2]) # Will appear on same figure
clf() # Clears entire figure (back to what you had with figure() )



Message: 10
Date: Tue, 09 Jan 2007 19:50:15 -0800
From: belinda thom <bthom@…1382…>
Subject: [Matplotlib-users] clearing a figure
To: matplotlib-users <>
Message-ID: <3E784898-1599-438A-BAC0-AB991179CE7D@…1382…>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed


I’m a new matplotlib user, coming from the Matlab end.

Is there a standard way to create a figure (here I’d like the
equivalent of matlab’s hold on, so I can draw multiple things) and

then clear the figure (so the drawing goes away) so I can repeat the
process again? The commands to plot that I’ll be using are fairly
simple line commands.

Take Surveys. Earn Cash. Influence the Future of IT
Join’s Techsay panel and you’ll get the chance to share your

opinions on IT & business topics through brief surveys - and earn cash

Matplotlib-users mailing list

End of Matplotlib-users Digest, Vol 8, Issue 13