Multiple plots above each other with common x-axis

Samuel Gougeon Samuel.Gougeon at univ-lemans.fr
Mon May 17 18:43:31 CEST 2010


Hello,

----- Message d'origine -----
De : Petar Knezevich
Date : 17/05/2010 13:39:
> Hi,
>
> Is it possible to stack multiple plots on top of each other with no
> vertical space between them and display the x-axis only on the bottom
> plot?  I would like to combine any number of plots in this manner
> (e.g. 2, 3, 4 or 5 plots).
>
> --------------------
> |      plot 1     |
> |                   |
> --------------------
> |      plot 2     |
> |                   |
> --------------------
> Common X-Axis
>   
Yes it is
> Is there already an option in subplot to produce this result?
> Currently I use a standard subplot configuration but there is too much
> space between each plot.
>   
Yes, subplot() is not dedicated to this task. There are several ways
to do what you whish. One of the easiest and most straightforward one
is to fit the .axes_bounds property by hand. Here is the most simple
example i may propose to you:

plot() // plots a sample with 2 subplots
a=gca(); // gets the handle of the last plot
twinkle(a) // to see which one was the last plotted
a.axes_bounds=[0 0.41 1 0.55 ];

You can even share a common X axis within different plots, etc.

To know more about possibilities, see as a starting point: help 
axes_properties
and display the handle:
a  <return>

Regards
Samuel




More information about the users mailing list