MATLAB: GUI Live Plot Issues

autosizeaxes issuesguiscatterxlimylim;

Hi there,
I am attempting to run a GUI that will output a plot of position obtained from a video. There are nested for loops for stepping through a video, then finding points to plot. As these points are found I would like them to all go to the same plot. My issue is that the axes go crazy as they autosize each time I initialize scatter- despite using hold on. Below is a cut down version of my code (I think it should be enough to represent the situation).
axes(handles.axes2)
set(handles.axes2,'Ydir','reverse');
xlim([0,720]);
ylim([0,480]);
grid on
for i = 1:numframes
if get(handles.stopper,'UserData')
pause on
uiwait
pause off
end
for j:(something relating to bboxes)
dataxy = calculations
scatter(datax,datay,'Parent',handles.axes2)
draw now
hold on
end
for k:(something relating to centroids)
dataxy = calculations2
scatter(datax,datay,'Parent',handles.axes2)
draw now
hold on
end
end
Any help is greatly appreciated.
Best regards,
Will

Best Answer

hold(handles.axes2, 'on')