Problem with axvline

Dear All,
I am running Debian testing on my box and I installed matplotlib from
the standard repositories.

From time to time I experience a problem when plotting several figures.

Consider the following code snippet:

#! /usr/bin/env python

import scipy as s
import numpy as n
import pylab as p

x=s.linspace(1.,100.,20)
y=s.linspace(40.,56.,20)

p.plot(x,y,"ko")
#p.axvline(30.)
p.xlabel('time')
p.ylabel('coordination number')
#p.legend(('beta=1e-2,100 part','beta=1e-1, 100 part', 'beta=1e-1, 200 part'))
p.title('Evolution coordination number in single cluster size')
p.grid(True)
p.savefig('test_no_av_line.pdf')
p.hold(False)
p.clf()

p.plot(x,y,"ko")
p.axvline(30.)
p.xlabel('time')
p.ylabel('coordination number')
#p.legend(('beta=1e-2,100 part','beta=1e-1, 100 part', 'beta=1e-1, 200 part'))
p.title('Evolution coordination number in single cluster size')
p.grid(True)
p.savefig('test_av_line.pdf')
p.hold(False)
p.clf()

My problem is that the second figure shows only the vertical line. If
I remove all the lines for the first plot (i.e. the one without
axvline), then the remaining plot is perfectly ok.
(1) Has anyone experienced the same problem/bug in matplotlib?
(2) Any idea of a possible fix?

Many thanks

Lorenzo

Le mercredi 05 mars 2008 � 15:19 +0100, Lorenzo Isella a �crit :

p.hold(False)

[...]

p.plot(x,y,"ko")
p.axvline(30.)

My problem is that the second figure shows only the vertical line. If
I remove all the lines for the first plot (i.e. the one without
axvline), then the remaining plot is perfectly ok.
(1) Has anyone experienced the same problem/bug in matplotlib?
(2) Any idea of a possible fix?

Since you turn hold to False, every new line that is added to axes (with
plot() or axvline()) deletes the existing lines. Removing p.hold(False)
may result in what you want.

···

--
Fabrice Silva <silva@...1918...>
LMA UPR CNRS 7051