thanks very much. Using expand_subplot for that purpose worked great,
but I am now trying a variant of this and am having trouble getting it
to work.
I'd like to create a subplot that has two parts: the left part is a
square plot, and the right part is a 2x2 set of square subplots.
Something like this:
http://www.mathworks.com/access/helpdesk_archive_ja_JP/r2007/help/toolbox/matlab/ref/image/subplot_vert.gif
Except the left hand plot should have square axes. just imagine
taking a square plot and putting it on the left, and then making a 2x2
subplot, which each subplot is less than 1/4 the size of the square
plot on the left, and putting that on the right hand panel.
is there a way to do this in matplotlib?
thanks.
On Sat, Dec 26, 2009 at 10:55 PM, JaeJoon Lee <lee.j.joon@...> wrote:
> On Thu, Dec 24, 2009 at 3:53 PM, per freem <perfreem@...> wrote:
>> i want it to eliminate the second
>> subplot of the first row and instead make the first subplot on the
>> first row take up two plots worth of space,
>
> Matpltlib's subplot does not support it as of now.
>
> There a few work around you may try, but it will at least take a few
> tens of lines of code. Attached is a way to do this by patching the
> object method, which I personally do not prefer but may be one of the
> easiest for normal users.
>
> Also, there is a patch I once worked on, but haven't pushed into the
> svn yet (i'm not sure if I ever will). So give it a try if you want.
>
> http://article.gmane.org/gmane.comp.python.matplotlib.general/19097
>
> Regards,
>
> JJ
>
>
> import matplotlib.transforms as mtransforms
>
> def expand_subplot(ax, num2):
> update_params_orig = ax.update_params
>
> ax._num2 = num2  1
> def _f(self=ax):
> num_orig = self._num
>
> self._num = self._num2
> update_params_orig()
> right, top = self.figbox.extents[2:]
>
> self._num = num_orig
> update_params_orig()
> left, bottom = self.figbox.extents[:2]
>
> self.figbox = mtransforms.Bbox.from_extents(left, bottom,
> right, top)
>
> ax.update_params = _f
> ax.update_params()
> ax.set_position(ax.figbox)
>
>
> ax = subplot(231)
> expand_subplot(ax, 2)
>
