how to remove a subplot

Hi everybody,

I want to delete a subplot from my figure. How to do that?

For example, I would like to remove the right subplot in the following
example:

···

########################
from pylab import *

ion()
f = figure()
s = f.add_subplot("121")
X1 = arange( 0.0, 5.0, 0.1 )
s.plot( X1, X1**2)

s = f.add_subplot("122")
s.plot( X1, sqrt( X1 ))

show()
########################

Thanks in advance,

Julien

--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)

Hmm, I didn't know you could pass a string in for the subplot arg :slight_smile:

Call f.delaxes(s) where s is the subplot instance you want to remove

JDH

···

On Wed, Jun 3, 2009 at 12:33 PM, TP <paratribulations@...185...> wrote:

Hi everybody,

I want to delete a subplot from my figure. How to do that?

For example, I would like to remove the right subplot in the following
example:

########################
from pylab import *

ion()
f = figure()
s = f.add_subplot("121")
X1 = arange( 0.0, 5.0, 0.1 )
s.plot( X1, X1**2)

s = f.add_subplot("122")
s.plot( X1, sqrt( X1 ))