File: exyplotc.m

package info (click to toggle)
octave-epstk 1.6-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 57
  • sloc: makefile: 34
file content (44 lines) | stat: -rw-r--r-- 1,617 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%exyplotc ( epsFile,x,y,xData,yData,color,dash,lineWidth)
% written by Stefan Mueller stefan.mueller@fgan.de 1997

function exyplotc ( epsFile,x,y,xData,yData,color,dash,lineWidth)
  if (nargin~=8)
    usage ('exyplotc ( epsFile,x,y,xData,yData,color,dash,lineWidth)');
  end
  [rows colums]=size(xData);
  if rows==1
    nData=colums;
    xyData=[xData; yData];
  else
    nData=rows;
    xyData=[xData'; yData'];
  end
  xyData=reshape(xyData,1,2*nData);
  nCurveData=nData-rem(nData-1,3);
  array=sprintf('%1.2f ',xyData(1:2*nCurveData));
  fprintf(epsFile,'/plotdata[%s] def\n',array);
  if dash>0
    fprintf(epsFile,'[%1.2f %1.2f] 0 setdash\n',dash,dash);
  end
  fprintf(epsFile,'currentrgbcolor %1.2f %1.2f %1.2f setrgbcolor\n',...
          color(1),color(2),color(3));
  fprintf(epsFile,'%1.2f %1.2f translate\n',x,y);
  fprintf(epsFile,'newpath\n');
  fprintf(epsFile,'plotdata 0 get plotdata 1 get moveto\n');
  fprintf(epsFile,'2 6 plotdata length 2 sub\n');
  fprintf(epsFile,'{ dup plotdata exch get\n');
  fprintf(epsFile,'exch 1 add dup plotdata exch get\n');
  fprintf(epsFile,'exch 1 add dup plotdata exch get\n');
  fprintf(epsFile,'exch 1 add dup plotdata exch get\n');
  fprintf(epsFile,'exch 1 add dup plotdata exch get\n');
  fprintf(epsFile,'exch 1 add plotdata exch get\n');
  fprintf(epsFile,'curveto } for\n');
  fprintf(epsFile,'%1.2f setlinewidth\n',lineWidth);
  if dash<0 
    fprintf(epsFile,'closepath fill\n');
  else
    fprintf(epsFile,'stroke\n');
  end
  fprintf(epsFile,'%1.2f %1.2f translate\n',-x,-y);
  fprintf(epsFile,'setrgbcolor\n');
  fprintf(epsFile,'[] 0 setdash\n');