/usr/share/octave/site/m/octave-epstk/egridcl.m is in octave-epstk 2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | %egridcl(epsFile,side,x,y,gridWidth,valueStart,valueStep,valueEnd,nMax,
% lineLength,lineWidth,color,dash)
% written by stefan.mueller@fhr.fraunhofer.de (C) 2010
function egridcl(epsFile,side,x,y,gridWidth,valueStart,valueStep,valueEnd,...
nMax,lineLength,lineWidth,color,dash)
if (nargin~=13)
eusage(...
'egridcl(epsFile,side,x,y,gridWidth,valueStart,valueStep,valueEnd,nMax,lineLength,lineWidth,color,dash)')
end
startEndDiff=valueEnd-valueStart;
signOfDiff=sign(startEndDiff);
if valueStep==0
valueStep=signOfDiff*eticdis(signOfDiff*startEndDiff,nMax);
end
valueStart=valueStart+valueStep;
startEndDiff=valueEnd-valueStart;
classValue=valueStart:valueStep:valueEnd;
classStart=classValue-valueStep/2;
classStart=(classStart-classStart(1))/...
(startEndDiff+valueStep);
classEnd=classStart+classStart(2);
if side=='s'
startPos=x;
xLength=gridWidth;
yLength=0;
moveForm=sprintf('%%1.2f %1.2f moveto\n',y);
ticLineForm='0 %1.2f rlineto\n';
elseif side=='n'
startPos=x;
xLength=gridWidth;
yLength=0;
moveForm=sprintf('%%1.2f %1.2f moveto\n',y);
ticLineForm='0 -%1.2f rlineto\n';
elseif side=='w'
startPos=y;
xLength=0;
yLength=gridWidth;
moveForm=sprintf('%1.2f %%1.2f moveto\n',x);
ticLineForm='%1.2f 0 rlineto\n';
elseif side=='e'
startPos=y;
xLength=0;
yLength=gridWidth;
moveForm=sprintf('%1.2f %%1.2f moveto\n',x);
ticLineForm='-%1.2f 0 rlineto\n';
end
nDash=1;
if dash(1)>0
if length(dash)>1
nDash=length(dash)-1;
dashSpace=dash(1);
dashSum=sum(dash(2:nDash+1));
dashL=dashSpace*nDash+dashSum;
dashList=zeros(nDash,3);
for i=1:nDash
dashList(i,1)=dash(i+1);
dashList(i,2)=dashL-dash(i+1);
dashList(i,3)=dashL-(dashSpace*(i-1)+sum(dash(2:i)));
end
else
nDash=1;
dashList=[dash(1) dash(1) 0];
end
end
% start draw
fprintf(epsFile,'currentrgbcolor %1.2f %1.2f %1.2f setrgbcolor\n',...
color(1),color(2),color(3));
for i=1:nDash
if dash(1)>0
fprintf(epsFile,'[%1.2f %1.2f] %1.2f setdash\n',...
dashList(i,1),dashList(i,2),dashList(i,3));
end
fprintf(epsFile,'newpath\n');
%lines
nClasses=size(classStart,2);
for j=1:nClasses
% grid line
currentPos=startPos+gridWidth*classStart(j);
fprintf(epsFile,moveForm,currentPos);
fprintf(epsFile,ticLineForm,lineLength);
currentPos=startPos+gridWidth*classEnd(j);
fprintf(epsFile,moveForm,currentPos);
fprintf(epsFile,ticLineForm,lineLength);
end
fprintf(epsFile,'%1.2f setlinewidth\n',lineWidth);
fprintf(epsFile,'stroke\n');
end
fprintf(epsFile,'setrgbcolor\n');
fprintf(epsFile,'[] 0 setdash\n');
|