MATLAB: Mouse click to get location on Graph and position text graphlocationmousetext; Is it possible to use a mouse to locate a position on a graph and then add user defined text. ideally using the mouse click callback? Thanks Jason Best Answer t = linspace(0,2*pi,50);y = sin(t);plot(t,y) %Plot anything here, can be an image aswellm, whatever.[x,y] = ginput(1); %Change the number if you want more than one textstr1 = 'test'; %This is the text displayedtext(x,y,str1) %Adds the text to the graph at x,yLike this?With more text:t = linspace(0,2*pi,50);y = sin(t);plot(t,y) str1 = {'Hello','this','is','Thomas!'}; [x,y] = ginput(length(str1)); text(x,y,str1) Related SolutionsMATLAB: Direction of display of loop How about this?t = linspace(0,2*pi);x = cos(t)*sqrt(5);y = sin(t)*sqrt(5/2);plot(x,y); hold onquiver(x(1),y(1),x(2)-x(1),y(2)-y(1),10) MATLAB: How to delete specified curved in a figure using a handle t = 0:0.1:2*pi;y = sin(t);h = plot(t,y);thendelete(h) Related QuestionText beside the pointer in ginputClarification regarding text in figureHow to annotate the MATLAB figure with arrowsProgramatically Delete UITree Nodes in App DesignerHow to determine max peak using ginput
Best Answer