Hello list -
I want to plot something in two subplots, then add something to the first subplot.
How do I select the first subplot after I have plotted on the second subplot?
For example:
subplot(211)
plot([1,2,3])
subplot(212)
plot([4,3,2])
Now I want to add something to the first subplot.
So I thought I could do subplot(211) again, but that destroys the subplot.
Any suggestions?
Thanks, Mark
Wow, a question I can actually answer:
ax1 = subplot(211)
ax2 = subplot(212)
ax1.plot([1,2,3])
ax2.plot([4,3,2])
ax1.plot([3,2,1])
Best,
-Tony
···
On Jun 10, 2008, at 9:09 AM, Mark Bakker wrote:
Hello list -
I want to plot something in two subplots, then add something to the first subplot.
How do I select the first subplot after I have plotted on the second subplot?
For example:
subplot(211)
plot([1,2,3])
subplot(212)
plot([4,3,2])
Now I want to add something to the first subplot.
So I thought I could do subplot(211) again, but that destroys the subplot.
Any suggestions?
Thanks, Mark
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
I do prefer Tony's solution, but in a more pylab'ic (matlab'ic) way,
there is also:
gcf().get_axes()[N].plot(...)
where N is the subplot you wan to access (starting from N=0).
···
Le mardi 10 juin 2008 à 09:27 -0400, Tony S Yu a écrit :
Wow, a question I can actually answer:
ax1 = subplot(211)
ax2 = subplot(212)
ax1.plot([1,2,3])
ax2.plot([4,3,2])
ax1.plot([3,2,1])
Thanks Tony -
I was hoping there was a plyab-ish command.
Like you can do Figure(1), Figure(2), and then reselect Figure(1) to get access to the first figure. No such command for subplot, I understand.
Cheers, Mark
···
On Tue, Jun 10, 2008 at 3:27 PM, Tony S Yu <tonyyu@…1166…> wrote:
Wow, a question I can actually answer:
ax1 = subplot(211)
ax2 = subplot(212)
ax1.plot([1,2,3])
ax2.plot([4,3,2])
ax1.plot([3,2,1])
Best,
-Tony
On Jun 10, 2008, at 9:09 AM, Mark Bakker wrote:
Hello list -
I want to plot something in two subplots, then add something to the first subplot.
How do I select the first subplot after I have plotted on the second subplot?
For example:
subplot(211)
plot([1,2,3])
subplot(212)
plot([4,3,2])
Now I want to add something to the first subplot.
So I thought I could do subplot(211) again, but that destroys the subplot.
Any suggestions?
Thanks, Mark
Check out the new SourceForge.net Marketplace.
It’s the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hey Mark,
Actually, recalling subplot(211) seems to work for me. Strange. You may want to try forcing the first plot to remain before drawing the second:
subplot(211)
plot([1,2,3])
hold(True)
subplot(212)
plot([4,3,2])
subplot(211)
plot([3,2,1])
-Tony
···
On Jun 10, 2008, at 9:29 AM, Mark Bakker wrote:
Thanks Tony -
I was hoping there was a plyab-ish command.
Like you can do Figure(1), Figure(2), and then reselect Figure(1) to get access to the first figure. No such command for subplot, I understand.
Cheers, Mark
On Tue, Jun 10, 2008 at 3:27 PM, Tony S Yu <tonyyu@…1166…> wrote:
Wow, a question I can actually answer:
ax1 = subplot(211)
ax2 = subplot(212)
ax1.plot([1,2,3])
ax2.plot([4,3,2])
ax1.plot([3,2,1])
Best,
-Tony
On Jun 10, 2008, at 9:09 AM, Mark Bakker wrote:
Hello list -
I want to plot something in two subplots, then add something to the first subplot.
How do I select the first subplot after I have plotted on the second subplot?
For example:
subplot(211)
plot([1,2,3])
subplot(212)
plot([4,3,2])
Now I want to add something to the first subplot.
So I thought I could do subplot(211) again, but that destroys the subplot.
Any suggestions?
Thanks, Mark
Check out the new SourceForge.net Marketplace.
It’s the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@…564…net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Yes, this is the expected behavior, you can reactivate any axes or
subplot by simply making the same axes or subplot call (with the same
arguments). This is discussed in the pylab tutorial section "working
with multiple figures and axes" at
http://matplotlib.sourceforge.net/tutorial.html#figs_and_axes
JDH
···
On Tue, Jun 10, 2008 at 8:41 AM, Tony S Yu <tonyyu@...1166...> wrote:
Hey Mark,
Actually, recalling subplot(211) seems to work for me. Strange.
Yep, that works. I thought I had tried that, but I must have done something wrong.
Sorry for the clutter,
Mark
···
On Tue, Jun 10, 2008 at 4:00 PM, John Hunter <jdh2358@…287…> wrote:
On Tue, Jun 10, 2008 at 8:41 AM, Tony S Yu <tonyyu@…1166…> wrote:
Hey Mark,
Actually, recalling subplot(211) seems to work for me. Strange.
Yes, this is the expected behavior, you can reactivate any axes or
subplot by simply making the same axes or subplot call (with the same
arguments). This is discussed in the pylab tutorial section "working
with multiple figures and axes" at
http://matplotlib.sourceforge.net/tutorial.html#figs_and_axes
JDH