Reputation: 9909
Using ginput
(or ginputax
) I ask my user to click on an axes 10 times (for spectrum baseline correction).
My axes is based on a GUIDE GUI.
Essentially this begins like this
plot(handles.axes_preview, ppm, xf_base, 'w-', 'LineWidth', 2);
spline_ppm = ginputax(handles.axes_preview, 10);
I'd like to plot each click (as ro
) as they're being input, so the user has some feedback of where they clicked.
Any ideas how to code this?
Upvotes: 1
Views: 522
Reputation: 112669
How about a simple loop?
axis(handles.axes_preview); %// make handles.axes_preview the current axis
hold on
for ii = 1:10
coords(ii,:) = ginput(1);
plot(coords(ii,1),coords(ii,2),'ro')
end
Also, you may want to add
set(handles.axes_preview),'XLimMode','manual');
set(handles.axes_preview),'YLimMode','manual');
at the beginning to prevent the axis scale from automatically changing as points are input by the user.
Upvotes: 1