InquilineKea
InquilineKea

Reputation: 891

How can I put a smaller figure right next to a larger figure using subplot (or some other way)?

Here's an example of such an arrangement (where the smaller figure is to the right of the larger figure).

enter image description here

Upvotes: 1

Views: 2071

Answers (2)

A. Donda
A. Donda

Reputation: 8477

Assuming that the first subplot is about 3 times as wide as the second, you can do it like this:

subplot(1, 4, 1 : 3)
% generate first plot

subplot(1, 4, 4)
% generate second plot

The trick is that one subplot can be composed of any rectangular collection of grid cells:

******************* *******
*     |     |     * *     *
*  1  |  2  |  3  * *  4  *
*     |     |     * *     *
******************* *******

For more information, see Subplots with Different Sizes in the documentation of subplot.

Upvotes: 3

Aliden
Aliden

Reputation: 451

I've never done this with subplot, which I think by definition uses a regular grid. What you'll want to do to achieve this effect is to create a second axis in your figure, which you can do easily through the GUI, and then switch back and forth between the two axes to configure each plot and the way the axes look.

Some potentially helpful references:

Axes (to add new axis)

Subplot only creates a grid

Upvotes: 0

Related Questions