Behavior of subplot

Michael D. Godfrey godfrey at isl.stanford.edu
Mon Feb 9 21:13:10 CST 2009


>
> So I suspect you just need to move the axis commands
> afte the plot commands, like this:
I did (finally) figure this out as you suggested.  It has
been a long time since I used Matlab for anything serious,
so...

>   hold off
>   x = [0:.1:10];
>   sx = sin(x);
>   cx = cos(x);
>   for k=1:3
>     subplot(2,3,k);
>     plot(x, sx);
>     axis([1,10,-1,1]);
>     subplot(2,3,3+k);
>     plot(x, 10*sx);
>     axis([1,20,-1,1]);   <-- axis([1,10,-10,10])
>   endfor
>
> Except for possible spacing problems, does that produce the plot you
> expect?
With the correction shown, yes.  In more complicated subplots, the hold on
is needed, but it all works now.

But, do not forget the spacing and bounding box problems.  Also, I
noticed that the old "plot_border" command is gone and there appears to
be no way to selectively turn off the sides of the "border box."  
Remember the
old plot_border("s","w"); command?  This is just a nostalgic remark --
do not worry about it.  There may well be a way to do that anyhow.


More information about the Bug-octave mailing list