From: Jeff on
Hi -
I am calling the plot function from within a while loop, which produces about 30 separate plots. However, each succeeding plot moves the x-axis closer to the right, to the point where the xticks and labels are all crammed in on the right hand side of the final plot. The first iteration plots correctly, but from then on the shifting of the xaxis occurs. I have tried reset, figure, newplot with various parameters, but to no avail. Help please!
Thanks!
Jeff
From: Jim Rockford on
On Sep 21, 6:44 pm, "Jeff " <meyej...(a)students.ipfw.edu> wrote:
> Hi -
> I am calling the plot function from within a while loop, which produces about 30 separate plots. However, each succeeding plot moves the x-axis closer to the right, to the point where the xticks and labels are all crammed in on the right hand side of the final plot. The first iteration plots correctly, but from then on the shifting of the xaxis occurs. I have tried reset, figure, newplot with various parameters, but to no avail. Help please!
> Thanks!
> Jeff


Sounds like you need to set plot properties like XLim.

Within your loop try the following:

hold('on'); % after the 1st plot
set(gca,'XLim',[x0 x1]) % x0 = left edge lim for plot, x1 = right
edge limit for plot (only need to do this once, I think)
From: Jeff on
Thanks Jim! Turns out I only needed to add "xlim ([start finish]);" to the while loop code. Your direction to the command xlim was the key. Thanks alot!
Jeff