home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / PLOTXY.DI$ / GRID.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  980 b   |  43 lines

  1. function grid(opt_grid);
  2. %GRID    Grid lines for 2-D and 3-D plots.
  3. %     GRID ON adds grid lines to the current axes.
  4. %     GRID OFF takes them off.
  5. %     GRID, by itself, toggles the grid state.
  6. %
  7. %    GRID sets the XGrid, YGrid, and ZGrid properties of
  8. %    the current axes.
  9. %
  10. %    See also TITLE, XLABEL, YLABEL, ZLABEL, AXES, PLOT.
  11.  
  12. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  13.  
  14. ax = gca;
  15.  
  16. if (nargin == 0)
  17.     if (strcmp(get(ax,'XGrid'),'off'))
  18.         set(ax,'XGrid','on');
  19.     else
  20.         set(ax,'XGrid','off');
  21.     end
  22.     if (strcmp(get(ax,'YGrid'),'off'))
  23.         set(ax,'YGrid','on');
  24.     else
  25.         set(ax,'YGrid','off');
  26.     end
  27.     if (strcmp(get(ax,'ZGrid'),'off'))
  28.         set(ax,'ZGrid','on');
  29.     else
  30.         set(ax,'ZGrid','off');
  31.     end
  32. elseif (strcmp(opt_grid, 'on'))
  33.     set(ax,'XGrid', 'on');
  34.     set(ax,'YGrid', 'on');
  35.     set(ax,'ZGrid', 'on');
  36. elseif (strcmp(opt_grid, 'off'))
  37.     set(ax,'XGrid', 'off');
  38.     set(ax,'YGrid', 'off');
  39.     set(ax,'ZGrid', 'off');
  40. else
  41.     error('Unknown command option.');
  42. end
  43.