Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2222 > unrolled thread

Re: [pyplot] using f1=figure(1)

Started by"eryksun ()" <eryksun@gmail.com>
First post2011-03-30 03:24 -0700
Last post2011-04-04 21:08 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: [pyplot] using f1=figure(1) "eryksun ()" <eryksun@gmail.com> - 2011-03-30 03:24 -0700
    Re: [pyplot] using f1=figure(1) Giacomo Boffi <giacomo.boffi@polimi.it> - 2011-04-04 21:08 +0200

#2222 — Re: [pyplot] using f1=figure(1)

From"eryksun ()" <eryksun@gmail.com>
Date2011-03-30 03:24 -0700
SubjectRe: [pyplot] using f1=figure(1)
Message-ID<6d3062b4-2b25-480d-89a9-8e2431866f2f@glegroupsg2000goo.googlegroups.com>
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

[toc] | [next] | [standalone]


#2585

FromGiacomo Boffi <giacomo.boffi@polimi.it>
Date2011-04-04 21:08 +0200
Message-ID<86oc4lx2au.fsf@aiuole.stru.polimi.it>
In reply to#2222
"eryksun ()" <eryksun@gmail.com> writes:

>     figure(fig1.number)
>     plot(...)

that's already much better than figure(1);...;figure(2);...

> Alternatively, you can use the plot methods of a particular axes:
>
>     fig1 = figure()
>     ax1 = axes()
>     fig2 = figure()
>     ax2 = axes()
>
>     ax1.plot(...)
>     ax2.plot(...)

that's nicer

> It works the same for subplots: [...]

thanks a lot
-- 
le mie sacrosante questioni di principio
          VS     gli sciocchi puntigli di quel cretino del mio vicino

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web