I need help on how to add a tooltip to my mouse when I move over an axes
object.
Suppose I have a figure with data over time on a large scale. I do not want
to zoom in to the point. I just want to place the mouse on the figure and
want the dat or time or whatver is associated with this point.
Is there any way to do it?
Any help is greatly appreciated.
Matthias
t = [0:pi/64:4*pi];
hold on;
for ii = 1:length(t)
a=text(t(ii),sin(t(ii)),'x','horizontalalignment','center','tag','a');
set(a,'buttondownfcn','tmp = get(gco,''position''); fprintf(''Position:
[%0.1f %0.1f]\n'',tmp(1),tmp(2));
set(findobj(''tag'',''a''),''color'',''k'',''fontweight'',''n'');
set(gco,''color'',''r'',''fontweight'',''b'');');
end
hold off
set(gca,'ylim',[-1, 1],'xlim',[min(t) max(t)]);
(It's possible to do something similar using uicontrols, but the positioning
of your data elements becomes more troublesome.)
Regards,
Brett
"Matthias Herzig" <matthia...@sf.hs-wismar.de> wrote in message
news:3d357...@kermit.rz.hs-wismar.de...
t = [0:pi/64:4*pi];
hold on;
for ii = 1:length(t)
a=text(t(ii),sin(t(ii)),'x','horizontalalignment','center','tag','a');
set(a,'buttondownfcn','tmp = get(gco,''position'');
set(postext,''string'',sprintf(''Position: [%0.1f,
%0.1f]\n'',tmp(1),tmp(2)));
set(findobj(''tag'',''a''),''color'',''k'',''fontweight'',''n'');
set(gco,''color'',''r'',''fontweight'',''b'');');
end
postext = text(0.3,-0.9,'');
hold off
set(gca,'ylim',[-1, 1],'xlim',[min(t) max(t)]);
Brett
"Matthias Herzig" <matthia...@sf.hs-wismar.de> wrote in message
news:3d357...@kermit.rz.hs-wismar.de...
t = [0:pi/64:4*pi];
hold on;
a=text(t,sin(t),'x','horizontalalignment','center','tag','a');
set(a,'buttondownfcn','tmp = get(gco,''position'');
set(postext,''string'',sprintf(''Position: [%0.1f,
%0.1f]\n'',tmp(1),tmp(2)));
set(findobj(''tag'',''a''),''color'',''k'',''fontweight'',''n'');
set(gco,''color'',''r'',''fontweight'',''b'');');
postext = text(0.3,-0.9,'');
hold off
set(gca,'ylim',[-1, 1],'xlim',[min(t) max(t)]);
Cheers (for the last time, I hope),
Brett
"Matthias Herzig" <matthia...@sf.hs-wismar.de> wrote in message
news:3d357...@kermit.rz.hs-wismar.de...