[pyplot] using f1=figure(1)

Blockheads Oi Oi breamoreboy at yahoo.co.uk
Mon Mar 28 12:55:47 EDT 2011


On 28/03/2011 17:04, Giacomo Boffi wrote:
> i executed the following interactions and i remained disappointed
>
> $ python
> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from pylab import *
>>>> f1=figure(1)
>>>> f2=figure(2)
>>>> f1
> <matplotlib.figure.Figure object at 0xb745668c>
>>>> f2
> <matplotlib.figure.Figure object at 0x8df834c>
>>>> plot(sin(linspace(0,10)),figure=f1)
> [<matplotlib.lines.Line2D object at 0x8df8fac>]
>>>> plot(cos(linspace(0,10)),figure=f2)
> [<matplotlib.lines.Line2D object at 0x8df8f0c>]
>>>> show()
>>>>
>
> i'm surely off by one in my understanding of the plot command, as i
> expected a sine in figure 1 and a cosine in 2, while what i got was a
> blank figure 1 and both the sine and the cosine in figure 2
>
> can anyone help me? tia
>                                                                  gb
>
I don't know why but this works fine.
f1=figure(1)
plot(sin(linspace(0,10)),figure=f1)
f2=figure(2)
plot(cos(linspace(0,10)),figure=f2)
show()

You're also likely to get more answers if you ask on the mailing list 
here https://lists.sourceforge.net/lists/listinfo/matplotlib-users.




More information about the Python-list mailing list