[pyplot] using f1=figure(1)

Discussion in 'Python' started by Giacomo Boffi, Mar 28, 2011.

  1. 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
    Giacomo Boffi, Mar 28, 2011
    #1
    1. Advertising

  2. 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.
    Blockheads Oi Oi, Mar 28, 2011
    #2
    1. Advertising

  3. Blockheads Oi Oi <> 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
    Giacomo Boffi, Mar 28, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert

    wxPython + pyPlot

    Robert, Oct 18, 2005, in forum: Python
    Replies:
    4
    Views:
    1,123
    Philippe C. Martin
    Oct 18, 2005
  2. Shah Sultan Alam

    PyPlot

    Shah Sultan Alam, Jan 16, 2009, in forum: Python
    Replies:
    0
    Views:
    544
    Shah Sultan Alam
    Jan 16, 2009
  3. Robert Kern

    Re: Pyplot

    Robert Kern, Jul 30, 2009, in forum: Python
    Replies:
    0
    Views:
    447
    Robert Kern
    Jul 30, 2009
  4. becky_s
    Replies:
    6
    Views:
    994
    Dennis Lee Bieber
    Aug 27, 2010
  5. Hans Georg Schaathun

    tiff/pbm in pyplot (ubuntu)

    Hans Georg Schaathun, Oct 19, 2011, in forum: Python
    Replies:
    0
    Views:
    172
    Hans Georg Schaathun
    Oct 19, 2011
Loading...

Share This Page