Behavior of subplot

Ben Abbott bpabbott at mac.com
Tue Feb 10 09:12:53 CST 2009


On Feb 9, 2009, at 10:13 PM, Michael D. Godfrey wrote:

>>
>> 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.

Michael, can you describe what is needed for "more complicated  
subplots"?

> 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."

Does the following do what you are looking for ...

	clf
	plot (1:10)
	set (gca, "box", "off")

Ben




More information about the Bug-octave mailing list