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
|
|
0
|
|
|
|
Reply
|
Giacomo
|
3/28/2011 4:04:02 PM |
|
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.
|
|
0
|
|
|
|
Reply
|
Blockheads
|
3/28/2011 4:55:47 PM
|
|
Blockheads Oi Oi <breamoreboy@yahoo.co.uk> writes:
> 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()
it works as well (with a proper t...)
plot(sin(t);figure(2);plot(cos(t));show()
because that's the way it is advised to do
in help(plot) one can read that in the named arguments that are
accepted from plot, you can say also figure=figurehandle, but it is
evident that i misundertood the issue
> You're also likely to get more answers if you ask on the mailing list
> here https://lists.sourceforge.net/lists/listinfo/matplotlib-users.
another mailing list? really i have to? <smilies, lots of>
--
Fan culo a quelli che quando si svegliano la mattina, non importa se
sono leoni o gazzelle, sono comunque delle bestie. -- Zonker, in IHC
|
|
0
|
|
|
|
Reply
|
Giacomo
|
3/28/2011 7:27:56 PM
|
|
On Monday, March 28, 2011 12:04:02 PM UTC-4, Giacomo Boffi wrote:
>
> >>> 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()
You can set the current figure to fig1 with the following:
figure(fig1.number)
plot(...)
Alternatively, you can use the plot methods of a particular axes:
fig1 = figure()
ax1 = axes()
fig2 = figure()
ax2 = axes()
ax1.plot(...)
ax2.plot(...)
It works the same for subplots:
fig1 = figure()
ax11 = subplot(211)
ax12 = subplot(212)
fig2 = figure()
ax21 = subplot(211)
ax22 = subplot(212)
ax12.plot(...)
#etc
|
|
0
|
|
|
|
Reply
|
eryksun (52)
|
3/30/2011 10:24:09 AM
|
|
|
3 Replies
167 Views
(page loaded in 0.049 seconds)
|