gusucode.com > demos工具箱matlab源码程序 > demos/ardemo.m

    function ardemo(Action,varargin)
%ARDEMO Interactive axes properties demonstration
%   Demonstrates the uses and interactions of the Data
%   Aspect Ratio, Plot Box Aspect Ratio and X-, Y-, and
%   Z-axes limits properties.
%
%   See also AXES.

%   Copyright 1984-2014 The MathWorks, Inc.


if nargin == 0 && isempty(findobj('Tag','AspectDemo')),  % Demo is being initialized
   Action = 'initialize';
elseif nargin == 0 && findobj('Tag','AspectDemo'),       % Demo is already open
   Action = 'None';
end

switch Action
   
   % Initialize the demonstration
   case 'initialize'
      LocalOpenFig;
      
      % Toggles the Auto/Manual labels on the buttons
   case 'ToggleButton'
      
      PropPopup = gcbo;
      PropString = get(PropPopup,'UserData');
      PropSetting = popupstr(PropPopup);
      PropName = get(PropString,'Tag');
      
      switch PropSetting
         case 'manual'
            set(findobj(gcf,'Tag','ActiveAxes'),[PropName 'Mode'],'manual');
            set(findobj(gcf,'Tag','StatusText'),'String', ...
               getString(message('MATLAB:demos:ardemo:LabelModeChangedToManual',PropName)));
            ardemo('SetProperty',PropPopup);
         case 'auto'
            set(findobj(gcf,'Tag','StatusText'),'String', ...
               getString(message('MATLAB:demos:ardemo:LabelModeChangedToAuto',PropName)));
            set(findobj(gcf,'Tag','ActiveAxes'),[PropName 'Mode'],'auto');
            ardemo('Refresh');
      end % switch PropSetting
      
      % Updates the edit boxes with the current axes properties
   case 'SetProperty'
      
      PropPopup = varargin{1};
      PropString = get(PropPopup,'UserData');
      PropName = get(PropString,'Tag');
      PropSetting = popupstr(PropPopup);
      
      % Error checking for brackets on string
      newstr = deblank(get(PropString,'String'));
      if ~strcmp(newstr(1),'[');
         newstr = ['[',newstr];
      end
      
      if ~strcmp(newstr(length(newstr)),']');
         newstr = [newstr,']'];
      end
      
      try
         tempval = eval(newstr);
      catch
         tempval = [];
      end
      oldval = get(PropString,'UserData');
      if ~isequal(length(tempval),length(oldval)),
         newval = oldval;
         set(findobj(gcf,'Tag','StatusText'),'String', ...
            getString(message('MATLAB:demos:ardemo:WarningInvalidPropertyValue',PropName,mat2str(oldval))));
      else
         newval = tempval;
         set(findobj(gcf,'Tag','StatusText'),'String', ...
            getString(message('MATLAB:demos:ardemo:LabelManuallyChangedTo',PropName,mat2str(newval,3))));
      end
      
      set(findobj(gcf,'Tag','ActiveAxes'),PropName,newval);
      
      ardemo('Refresh');
      
      % Updates the edit boxes with the current axes properties
   case 'Refresh'
      
      ax = findobj(gcf,'Tag','ActiveAxes');
      set(findobj(gcf,'Tag','DataAspectRatio'),'string',mat2str(get(ax,'DataAspectRatio'),3));
      set(findobj(gcf,'Tag','PlotBoxAspectRatio'),'string',mat2str(get(ax,'PlotBoxAspectRatio'),3));
      set(findobj(gcf,'Tag','XLim'),'string',mat2str(get(ax,'XLim'),3));
      set(findobj(gcf,'Tag','YLim'),'string',mat2str(get(ax,'YLim'),3));
      set(findobj(gcf,'Tag','ZLim'),'string',mat2str(get(ax,'ZLim'),3));
      
      DARMode = get(ax,'DataAspectRatioMode');
      if strcmp(DARMode,'auto')
         set(findobj(gcf,'Tag','DARbutton'),'value',1);
      else
         set(findobj(gcf,'Tag','DARbutton'),'value',2);
      end % if/else strcmp(DARMode)
      
      PBARMode = get(ax,'PlotBoxAspectRatioMode');
      if strcmp(PBARMode,'auto')
         set(findobj(gcf,'Tag','PBARbutton'),'value',1);
      else
         set(findobj(gcf,'Tag','PBARbutton'),'value',2);
      end % if/else strcmp(PBARMode)
      
      XMode = get(ax,'XlimMode');
      if strcmp(XMode,'auto')
         set(findobj(gcf,'Tag','Xbutton'),'value',1);
      else
         set(findobj(gcf,'Tag','Xbutton'),'value',2);
      end % if/else strcmp(XMode)
      
      YMode = get(ax,'YlimMode');
      if strcmp(YMode,'auto')
         set(findobj(gcf,'Tag','Ybutton'),'value',1);
      else
         set(findobj(gcf,'Tag','Ybutton'),'value',2);
      end % if/else strcmp(YMode)
      
      ZMode = get(ax,'ZlimMode');
      if strcmp(ZMode,'auto')
         set(findobj(gcf,'Tag','Zbutton'),'value',1);
      else
         set(findobj(gcf,'Tag','Zbutton'),'value',2);
      end % if/else strcmp(ZMode)
      
      % Plot the 2D picture
   case '2D'
      TwoDbutton = findobj(gcf,'Tag','2Dbutton');
      val = get(TwoDbutton,'Value');
      if val == 0,
         set(TwoDbutton,'value',1);
      elseif val == 1,
         set(findobj(gcf,'Tag','3Dbutton'),'value',0);
         set(findobj(gcf,'Tag','Manbutton'),'value',0);
         
         set(findobj(gcf,'Tag','StatusText'),'String', ...
            getString(message('MATLAB:demos:ardemo:LabelWaitWhile2DDataLoaded')));
         
         LocalMouse;
         ardemo('Refresh')
      end % if/else val
      
      % Plot the 3D picture
   case '3D'
      ThreeButton = findobj(gcf,'Tag','3Dbutton');
      val = get(ThreeButton,'Value');
      if val == 0,
         set(ThreeButton,'value',1);
      elseif val == 1,
         set(findobj(gcf,'Tag','Manbutton'),'value',0);
         set(findobj(gcf,'Tag','2Dbutton'),'value',0);
         set(findobj(gcf,'Tag','StatusText'),'String',getString(message('MATLAB:demos:ardemo:LabelWaitWhile3DDataLoaded')));
         L = membrane(1);
         x = -1:1/15:1;
         surf(x,x',L);
         set(gca,'Tag','ActiveAxes');
         set(findobj(gcf,'Tag','StatusText'),'String', ...
            getString(message('MATLAB:demos:ardemo:LabelUseTheControlsToSeeEffects3d')));
         ardemo('Refresh');
      end % if/else val
      
      % Plot the user specified data
   case 'Plot'
      ManButton = findobj(gcf,'Tag','Manbutton');
      val = get(ManButton,'Value');
      if val == 0 && ~(get(findobj(gcf,'Tag','3Dbutton'),'Value')) && ~(get(findobj(gcf,'Tag','2Dbutton'),'Value')),
         set(ManButton,'value',1);
      elseif val == 1,
         set(findobj(gcf,'Tag','3Dbutton'),'value',0);
         set(findobj(gcf,'Tag','2Dbutton'),'value',0);
         PlotStr = get(findobj(gcf,'Tag','PlotText'),'String');
         if ~isempty(PlotStr);
            eval(PlotStr);
            set(gca,'Tag','ActiveAxes');
            set(findobj(gcf,'Tag','StatusText'),'String',getString(message('MATLAB:demos:ardemo:LabelUserDefinedPlot')));
            ardemo('Refresh');
            hold off
         else
            set(findobj(gcf,'Tag','StatusText'),'String', ...
               getString(message('MATLAB:demos:ardemo:PromptEnterAValidPlotCommandOrFunction')));
         end % if ~isempty(PlotStr)
      end % if/else val
      
      % On-line help
   case 'Help'
      HelpStr = {'Aspect Ratio Demonstration';
         '';
         'The purpose of the demonstration is to present a graphical ';
         'interpretation of various axes properties and how they interact. ';
         'The white box represents a constant axes with the same ';
         'position property as the active plotting axis. Use it as a ';
         'reference as you change the other properties, including: ';
         '1) Data Aspect Ratio: The relative scaling of the data units along ';
         'the three axes; 2) Plot Box Aspect Ratio: The relative scaling ';
         'of the plotbox along the three axes; and 3) The X,Y, and Z axis limits.';
         '';
         'Use the radio buttons to plot the default 2D or 3D plots or enter';
         ' the name of a plotting function or a valid plotting command in';
         ' the edit box and select its radio button.';
         '';
         'Use the popup menus to toggle the setting of the axes properties. ';
         'In a manual setting, use the edit boxes to enter the ';
         'desired property value '};
      
      helpwin(HelpStr,'ARDEMO Help');
      
      % Bring Axes Demo figure to front, if it already exists
   case 'None'
      
      figure(findobj(gcf,'Tag','AspectDemo'))
      
end % switch

% ---------------------------------Internal functions------------------------------------

function LocalOpenFig()

StdUnit = 'point';
StdColor = get(0,'DefaultUIcontrolBackgroundColor');
PointsPerPixel = 72/get(0,'ScreenPixelsPerInch');

% Open a new figure
a = figure('Color',[0.8 0.8 0.8], ...
   'Position',[25 65 560 440], ...
   'IntegerHandle','off', ...
   'NumberTitle','off',...
   'Name',getString(message('MATLAB:demos:ardemo:FigureAxesPropertiesDemonstration')),...
   'Tag','AspectDemo');

% Add the axes
% Reference axis
b = axes('Parent',a, ...
   'Units',StdUnit, ...
   'Box','on', ...
   'Color',[1 1 1], ...
   'Position',PointsPerPixel*[18 199 289 227], ...
   'Units','Normalized',...
   'XColor',[0 0 0], ...
   'XGrid','off', ...
   'XTick',[],...
   'YColor',[0 0 0], ...
   'YGrid','off', ...
   'YTick',[], ...
   'ZColor',[0 0 0], ...
   'ZGrid','off', ...
   'ZTick',[]);

set(get(b,'XLabel'),'visible','off');
set(get(b,'YLabel'),'visible','off');
set(get(b,'ZLabel'),'visible','off');

% Plotting axis
b = axes('Parent',a, ...
   'Units',StdUnit, ...
   'Color',[1 1 1], ...
   'Position',PointsPerPixel*[18 199 289 227], ...
   'Units','Normalized',...
   'Tag','ActiveAxes', ...
   'Box','on', ...
   'XColor',[0 0 0], ...
   'XGrid','on', ...
   'YColor',[0 0 0], ...
   'YGrid','on', ...
   'ZColor',[0 0 0], ...
   'ZGrid','on');

% Add the 3D plot as the default
L = membrane(1);
x = -1:1/15:1;
surf(x,x',L);
set(gca,'Tag','ActiveAxes');

% Add various frames
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[0.8 0.8 0.8], ...
   'Position',PointsPerPixel*[312 143 235 284], ...
   'Units','Normalized',...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[312 90 235 44], ...
   'Units','Normalized',...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[321 371 217 48], ...
   'Units','Normalized',...
   'Tag','DARframe', ...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[321 316 217 48], ...
   'Units','Normalized',...
   'Tag','PBARframe', ...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[321 261 217 48], ...
   'Units','Normalized',...
   'Tag','Xframe', ...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[321 206 217 48], ...
   'Units','Normalized',...
   'Tag','Yframe', ...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[321 151 217 48], ...
   'Units','Normalized',...
   'Tag','Zframe', ...
   'Style','frame');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[14 90 292 88], ...
   'Units','Normalized',...
   'Style','frame');

% Add radio buttons for specifying type of plot
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[32 156 249 13], ...
   'Units','Normalized',...
   'Style','text',...
   'String',getString(message('MATLAB:demos:ardemo:LabelSelectPlotType')));

b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'CallBack','ardemo(''2D'');', ...
   'Position',PointsPerPixel*[32 140 110 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:Label2DDefault')), ...
   'Style','radiobutton', ...
   'Tag','2Dbutton');

b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'CallBack','ardemo(''3D'');', ...
   'Position',PointsPerPixel*[32 123 110 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:Label3DDefault')), ...
   'Style','radiobutton', ...
   'Tag','3Dbutton', ...
   'Value',1);
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'CallBack','ardemo(''Plot'');', ...
   'Position',PointsPerPixel*[32 103 22 20], ...
   'Units','Normalized',...
   'Style','radiobutton', ...
   'Tag','Manbutton', ...
   'Value',0);

b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[54 103 235 20], ...
   'Units','Normalized',...
   'Style','edit', ...
   'Horiz','left', ...
   'callback','ardemo(''Plot'');',...
   'Tag','PlotText');

% Add text to describe the various Axes property controls

b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 395 127 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelDataAspectRatio')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 373 127 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelDARMode')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 339 127 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelPlotBoxAspectRatio')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 318 127 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelPBARMode')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 285 108 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelXAxisLimit')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 262 109 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelXLimMode')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 231 109 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelYAxisLimit')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 208 109 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelYLimMode')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 177 109 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelZAxisLimit')), ...
   'Style','text');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'HorizontalAlignment','left', ...
   'Position',PointsPerPixel*[326 154 109 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:LabelZLimMode')), ...
   'Style','text');

% Add controls for specifying the varous Axes properties

% DAR
DARstr = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[452 396 81 20], ...
   'Units','Normalized',...
   'String',mat2str(get(findobj(gcf,'Tag','ActiveAxes'),'DataAspectRatio'),3), ...
   'Style','edit', ...
   'Horiz','left', ...
   'UserData',[get(findobj(gcf,'Tag','ActiveAxes'),'DataAspectRatio')], ...
   'Callback',['ardemo(''SetProperty'',findobj(gcf,''Tag'',''DARbutton''));'],...
   'Tag','DataAspectRatio');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Style','popup', ...
   'Position',PointsPerPixel*[452 376 81 17], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:ComboBoxAutoManual')), ...
   'UserData',DARstr, ...
   'callback','ardemo(''ToggleButton'');', ...
   'Tag','DARbutton');

% PBAR
PBARstr = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[452 342 81 20], ...
   'Units','Normalized',...
   'String',mat2str(get(findobj(gcf,'Tag','ActiveAxes'),'PlotBoxAspectRatio'),3), ...
   'Style','edit', ...
   'Horiz','left', ...
   'UserData',[get(findobj(gcf,'Tag','ActiveAxes'),'PlotBoxAspectRatio')], ...
   'Callback',['ardemo(''SetProperty'',findobj(gcf,''Tag'',''PBARbutton''));'],...
   'Tag','PlotBoxAspectRatio');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'Style','popup', ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[452 321 81 18], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:ComboBoxAutoManual')), ...
   'UserData',PBARstr, ...
   'Callback','ardemo(''ToggleButton'');', ...
   'Tag','PBARbutton');

% Xlim
XlimStr = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[452 287 81 20], ...
   'Units','Normalized',...
   'String',mat2str(get(findobj(gcf,'Tag','ActiveAxes'),'XLim'),3), ...
   'Style','edit', ...
   'Horiz','left', ...
   'UserData',[get(findobj(gcf,'Tag','ActiveAxes'),'XLim')], ...
   'Callback',['ardemo(''SetProperty'',findobj(gcf,''Tag'',''Xbutton''));'],...
   'Tag','XLim');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Style','popup', ...
   'Position',PointsPerPixel*[452 266 81 18], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:ComboBoxAutoManual')), ...
   'UserData',XlimStr, ...
   'Callback','ardemo(''ToggleButton'');', ...
   'Tag','Xbutton');

% Ylim
YlimStr = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[452 232 81 20], ...
   'Units','Normalized',...
   'String',mat2str(get(findobj('Tag','ActiveAxes'),'YLim'),3), ...
   'Horiz','left', ...
   'Style','edit', ...
   'UserData',[get(findobj('Tag','ActiveAxes'),'YLim')], ...
   'Callback',['ardemo(''SetProperty'',findobj(gcf,''Tag'',''Ybutton''));'],...
   'Tag','YLim');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Style','popup', ...
   'Position',PointsPerPixel*[452 211 81 18], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:ComboBoxAutoManual')), ...
   'UserData',YlimStr, ...
   'Callback','ardemo(''ToggleButton'');', ...
   'Tag','Ybutton');

% Zlim
ZlimStr = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Position',PointsPerPixel*[452 177 81 20], ...
   'Units','Normalized',...
   'String',mat2str(get(findobj('Tag','ActiveAxes'),'ZLim'),3), ...
   'Style','edit', ...
   'Horiz','left', ...
   'UserData',[get(findobj('Tag','ActiveAxes'),'ZLim')], ...
   'Callback',['ardemo(''SetProperty'',findobj(gcf,''Tag'',''Zbutton''));'],...
   'Tag','ZLim');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',[1 1 1], ...
   'Style','popup', ...
   'Position',PointsPerPixel*[452 156 81 18], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:ardemo:ComboBoxAutoManual')), ...
   'UserData',ZlimStr, ...
   'Callback','ardemo(''ToggleButton'');', ...
   'Tag','Zbutton');

% Add figure option buttons
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'Position',PointsPerPixel*[321 99 90 26], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:shared:LabelHelp')), ...
   'callback','ardemo(''Help'');',...
   'Tag','Helpbutton');
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'CallBack','close(gcf)', ...
   'Position',PointsPerPixel*[448 99 90 26], ...
   'Units','Normalized',...
   'String',getString(message('MATLAB:demos:shared:LabelClose')), ...
   'Tag','Closebutton');

% Add a status box on the bottom of the figure
b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[14 18 534 64], ...
   'Units','Normalized',...
   'Style','frame');

b = uicontrol('Parent',a, ...
   'Unit',StdUnit, ...
   'BackgroundColor',StdColor, ...
   'Position',PointsPerPixel*[24 28 497 40], ...
   'Units','Normalized',...
   'Style','text',...
   'String',getString(message('MATLAB:demos:ardemo:LabelDefault3DView')),...
   'Tag','StatusText');

set(a,'visible','on','HandleVisibility','callback');


function LocalMouse()

ax = findobj('Tag','ActiveAxes');
theta = (1:1:360).*(pi/180);
R1 = 0.15;
R2 = .25;

X1 = R1.*cos(theta)+0.25;
Y1 = R1.*sin(theta)+0.5;

fill(X1,Y1,'k')

hold on

X2 = R1.*cos(theta)+0.75;
Y2 = R1.*sin(theta)+0.5;

X3 = R2.*cos(theta)+0.5;
Y3 = R2.*sin(theta)+0.33;

fill(X2,Y2,'k')
fill(X3,Y3,'k')
hold off
set(gca,'Tag','ActiveAxes')

str = getString(message('MATLAB:demos:ardemo:LabelUseTheControlsToSeeEffects2d'));
set(findobj('Tag','StatusText'),'String',str);