JJ,

Thank you for sharing this. Although I have to admit I'm a bit surprised by
what
it takes to accomplish this, I think I will be able to use your class to do
what I need
to do, or at least get  a lot of the way there.

Cheers,
-adam.

On Tue, Sep 9, 2008 at 5:34 PM, Jae-Joon Lee <[EMAIL PROTECTED]> wrote:

> Adam,
>
> I needed a same thing a while ago and I ended up with a custom class.
> Although this need some more work, try and see if it fits your need in
> case you want to avoid the little arithmetic that John mentioned.
> The python file and a example plot are attached.
>
> I wanted the padding between the subaxes is conserved even if the
> figure size changes (and something more), so the implementation got
> little bit hackish and much longer than I initially expected, but it
> works for me.
> A simple use case is included in the file (I'm afraid that there are
> not much documentation).
>
>
> Briefly,
>
>
> import matplotlib.pyplot as plt
> from mpl_multiaxes import MultiPane_Subplot
>
> F = plt.figure(1)
> F.clf()
>
> mp = MultiPane_Subplot(F, subplot_pos=(1, 1, 1),
>                       nrows_ncols = (3, 2),
>                       n_pane=5,
>                       pane_direction="row", # or "column"
>                       axes_pad_inch=0.0,
>                       )
>
> F.add_subplot(mp)
>
>
> In the above example, MultiPane_Subplot is a subclass of the Subplot
> which contains subaxes. You set number of rows and columns for your
> subaxes grid. If the number of subaxes is smaller than nrows*ncols,
> you explicitly set it with n_pane.
>
> After this, each subaxes is accessed as mp[0], mp[1], and so on. They
> are subclass of Axes. So you may use any drawing method that Axes
> class has. As mp is subclass of Subplot, it is also an axes. I
> consider it as a kind of master axes. Anything you plot in this axes
> is also drawn in all of its subaxes.  Also note that xaxis and yaxis
> are shared among these subaxes, therefore they have same xlim, ylim.
> etc.
>
> Regards,
>
> -JJ
>
>
> On Tue, Sep 9, 2008 at 8:12 AM, Adam <[EMAIL PROTECTED]> wrote:
> >
> > John,
> >
> >> By default, matplotlib will resize your axes to preserve the aspect
> >> ratio of your image, which in the case of your 23x25 images is not
> >> equal.  You can override this behavior by setting aspect='auto'
> >>
> >> for i in range(6):
> >>  fig1.add_subplot(2,3,i+1)
> >>  pylab.imshow(data, aspect='auto')
> >
> > This gets rid of the blank space, but at the expense of the aspect ratio,
> as
> > you mention.  Isn't there away to preserve the aspect ratios of the
> > individual
> > sub-images, and just remove the white space between them?  I really to
> not
> > want to mess with the images themselves.
> >
> > cheers,
> > adam.
> >
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> > Build the coolest Linux based applications with Moblin SDK & win great
> > prizes
> > Grand prize is a trip for two to an Open Source event anywhere in the
> world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to