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

  1. function h = polyline(x,y,style,opt_sc)
  2. %POLYLINE Basic line drawing primitive.
  3. %       POLYLINE is obsolete, but provided for upward compatibility from
  4. %       MATLAB 3.5.
  5. %
  6. %    POLYLINE(X,Y) draws the polyline whose X- and Y-coordinates
  7. %    are in vectors X and Y.
  8. %    POLYLINE(X,Y,'type') draws the line with the style and color
  9. %    indicated by the text string.  See PLOT for a list of
  10. %    style and color attributes.
  11. %    POLYLINE(X,Y,'sc') interprets X and Y in screen-coordinates
  12. %    where (0.0,0.0) is the lower-left corner of the screen and
  13. %    (1.0,1.0) is the upper-right corner.  Otherwise, data-
  14. %    coordinates are used.
  15.  
  16. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  17.  
  18. disp('This usage of polyline is obsolete and will be eliminated in future')
  19. disp('versions.  Please use line instead.')
  20. opt = 'data';
  21. linestyle = '-';
  22. if nargin == 3
  23.         if strcmp(style,'sc')
  24.                 opt = 'norm';
  25.     else
  26.         linestyle = style;
  27.         end
  28. elseif nargin == 4
  29.     if strcmp(opt_sc,'sc') | strcmp(opt_sc,'norm')
  30.             opt = opt_sc;
  31.     else
  32.         error('Invalid input argument.')
  33.     end
  34.         linestyle = style;
  35. end
  36. if isstr(x) | isstr(y)
  37.     error('Input data must be numeric.')
  38. end
  39. if strcmp(opt,'norm')
  40.         [xx,yy] = sc2dc(x,y);
  41. else
  42.         xx = x; yy = y;
  43. end
  44. [a,b] = colstyle(linestyle);
  45. cax = newplot;
  46. next = lower(get(cax,'NextPlot'));
  47. hold_state = ishold;
  48. if ~hold_state & strcmp(opt,'norm')
  49.     axis([0 1 0 1]);
  50.     if length(get(gca,'children')) == 0
  51.         set(gca,'box','on')
  52.     end
  53. end
  54. hh = line(xx,yy,'Clipping','off');
  55. if ~isempty(a), status = set(hh,'linestyle',a); end
  56. if ~isempty(b), status = set(hh,'color',b); end
  57. if nargout == 1
  58.         hh = h;
  59. end
  60.  
  61.