home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / GRAPHICS.DI$ / NEWPLOT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.2 KB  |  39 lines

  1. function ah = newplot()
  2. %NEWPLOT Graphics M-file preamble to handle the NextPlot property.
  3. %    H = NEWPLOT is a standard preamble command that is put at
  4. %    the beginning of graphics M-file functions that draw graphs
  5. %    using only low-level object creation commands. NEWPLOT
  6. %    "does the right thing" in terms of determining which axes and/or
  7. %    figure to draw the plot in, based upon the setting of the
  8. %    NextPlot property of axes and figure objects, and returns a
  9. %    handle to the appropriate axes.
  10. %
  11. %    The "right thing" is:
  12. %
  13. %    Open a new figure if the figure NextPlot is "New",
  14. %    Clear and reset the current figure if figure NextPlot is "Replace",
  15. %    Open a new axes if the axes NextPlot is "New",
  16. %    Clear and reset the current axes if axes NextPlot is "Replace".
  17. %
  18. %    See also HOLD, ISHOLD, FIGURE, AXES.
  19.  
  20.  
  21. %    L. Shure, 2-3-92, Revised 4-2-92 JNL
  22. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  23.  
  24. fh = gcf;
  25. fig_state = lower(get(fh,'NextPlot'));
  26. if strcmp(fig_state,'new');
  27.     fh = figure;
  28. elseif strcmp(fig_state,'replace');
  29.     clf reset;
  30. end
  31.  
  32. ah = gca;
  33. ax_state = lower(get(ah,'NextPlot'));
  34. if strcmp(ax_state,'new')
  35.     ah = axes;
  36. elseif strcmp(ax_state,'replace')
  37.     cla reset;
  38. end
  39.