www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mvgraph2d/private/infoaxes.m

    function [ax,txt]=infoaxes(gr)
%INFOAXES   Private function
%  INFOAXES returns a set of axes and a text handle, ready for popping
%  up with point information in it.  The handle is retained in
%  persistent memory so the destroy function can operate reliably
%  Available arguments are 'new', 'current' and 'destroy'

%  Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc.


hFig = ancestor(gr.panel,'figure');
% place box where mouse is
pos = get(hFig,'CurrentPoint');
pos = mbcgui.util.convertLocation(pos, gr.panel); 

pos(3) = 60;
pos(4) = 30;
pos(2) = pos(2)-45;
pos(1) =  pos(1)+5;

ax=axes('Parent',gr.panel,...
    'Visible','off',...
    'Units','pixels',...
    'Position',pos,...
    'Color',[1 1 .85],...
    'Box','on',...
    'XLim',[0 1],...
    'YLim',[0 1],...
    'XTick',[],...
    'YTick',[]);
txt=text('Parent',ax,...
    'Clipping','on',...
    'Position',[0.04 1],...
    'HorizontalAlignment','left',...
    'VerticalAlignment','top',...
    'FontSize',8);