/usr/share/octave/site/m/octave-epstk/eimagesc.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 96 97 | %%NAME
%% eimagesc - draw scaled image of a matrix
%%
%%SYNOPSIS
%% x=eimagesc(matrix[,colorMap[,legendOrientation[,legendScale]]])
%%
%%PARAMETER(S)
%% matrix matrix for image
%% colorMap define own colormap
%% legendOrientation side of the image where the legend appears
%% character 's'(south),'n'(north),'w'(west) or 'e'(east)
%% (default orientation is south)
%% legendScale scale vector of legend [start step end]
%% special cases of scale vector are:
%% if start=0 and end=0 then autorange=on
%% if step=0 then autoscale=on
%% (default scale vector=[0 0 0])
%% x scaled image matrix
%% special case of return parameters:
%% if the return parameters are used then no output
%%
%%GLOBAL PARAMETER(S)
%% ePlotAreaPos
%% ePlotAreaWidth
%% ePlotAreaHeight
%% eImageDefaultColorMap
%% eImageLegendScale
%% eYAxisWestScale
%% eXAxisSouthScale
% written by stefan.mueller@fhr.fraunhofer.de (C) 2010
function x=eimagesc(matrix,colorMap,legendOrientation,legendScale)
if (nargin>4)
eusage('x=eimagesc(matrix[,colorMap[,legendOrientation[,legendScale]]])');
end
eglobpar;
if nargin<4
legendScale=eImageLegendScale;
end
if nargin<3
legendOrientation='s';
end
if nargin<2
colorMap=ecolors(eImageDefaultColorMap);
end
if nargin<1
[matrix colorMap]=eppmread([ePath 'default.ppm']);
ePlotTitleText='Photo';
end
% scale image
mSize=size(matrix);
matrix=reshape(matrix,mSize(1)*mSize(2),1);
minval=min (matrix);
maxval=max (matrix);
if legendScale(1)~=legendScale(3)
if legendScale(1)>minval
pos=find(matrix<legendScale(1));
matrix(pos)=legendScale(1);
end
minval=legendScale(1);
if legendScale(3)<maxval
pos=find(matrix>legendScale(3));
matrix(pos)=legendScale(3);
end
maxval=legendScale(3);
end
matrix=reshape(matrix,mSize(1),mSize(2));
if eImageLegendScaleType==2
minval=log10(minval);
maxval=log10(maxval);
matrix=log10(matrix);
end
if (maxval - minval)<=1000*eps
maxval=minval+1000*eps;
end
legendScale(1)=minval;
legendScale(3)=maxval;
colorScaleFac=size(colorMap,1)/((maxval-minval)*(1+1e-15));
x=fix((matrix-minval)*colorScaleFac)+1;
if nargout==0
eimage(x,colorMap)
% image axes
if eYAxisWestScale(1)==eYAxisWestScale(3)
eYAxisWestScale=[size(matrix,1) 0 0];
end
if eXAxisSouthScale(1)==eXAxisSouthScale(3)
eXAxisSouthScale=[0 0 size(matrix,2)];
end
egrid;
eaxes;
% color legend
eimgleg(ePlotAreaPos(1),ePlotAreaPos(2),ePlotAreaWidth,ePlotAreaHeight,...
colorMap,legendScale,legendOrientation);
end
|