[pyplot] using f1=figure(1)
eryksun ()
eryksun at gmail.com
Wed Mar 30 06:24:09 EDT 2011
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
More information about the Python-list
mailing list