One work around is to call

  self.figure.subplots_adjust()

after geometry changed. After this call, the twinx-ed axes will have
the same axes position as the original one.

Another option is to use mpl_toolkits.axes_grid
(http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#parasiteaxes).
But the previous solution seems to be much easier for you.
Regards,

-JJ


On Thu, Jul 16, 2009 at 1:16 PM, Tom Vaughan<t...@software6.net> wrote:
> On Tue, Jun 2, 2009 at 07:33, John Hunter<jdh2...@gmail.com> wrote:
>> On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan <t...@software6.net> wrote:
>>> Is it possible to add subplots to a figure if I don't know in advance
>>> how many subplots I need to add?
>>>
>>> What I do now is I call add_subplot like add_subplot(i, 1, i) where i
>>> is 1 initially, and just increases by 1 on each call. This almost
>>> works. Except the first plot takes up the whole figure, the second
>>> plot is placed on top of the bottom half of the first plot, etc. Is
>>> there a way to "resize" the plots when a subplot is added? Or how
>>> would I "re-plot" the previous subplots?
>>
>> See the Axes.change_geometry command
>>
>>  http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry
>
> twinx() does not return an axes that contains the change_geometry
> method. How then can I do the equivalent on this axes? Calling twinx()
> again on the original axes after change_geometry() has been called
> does not do the trick. Thanks.
>
> -Tom
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to