Description of TextPropUDF

Home > BiKEGG > TextPropUDF.m

# TextPropUDF

## PURPOSE

TextPropUDF

## SYNOPSIS

function TextPropUDF (TextFont,TextCol,flxType,idxt,idyt,idwt,idht,k,flx,h1,Thresh)

## DESCRIPTION

     TextPropUDF
     Based on user defined properties of text properties, changes
     text color and font properties on map images.

     O. Jamialahmadi
     TMU, Chem. Eng. Dept., Biotech. Group
     Apr. 2015

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- KeggDraw KeggDraw

## SOURCE CODE

    0001 function TextPropUDF (TextFont,TextCol,flxType,idxt,idyt,idwt,idht,k,flx,h1,Thresh)
    0002 % TextPropUDF
    0003 % Based on user defined properties of text properties, changes
    0004 % text color and font properties on map images.
    0005 %
    0006 % O. Jamialahmadi
    0007 % TMU, Chem. Eng. Dept., Biotech. Group
    0008 % Apr. 2015
    0009
    0010 if isempty(TextCol) % Set default value
    0011     TextCol=[1, 0.98,0.82];
    0012 end
    0013
    0014 switch flxType
    0015     case 'One'
    0016
    0017        if isempty(TextFont) % Set default properties
    0018             TextFont.FontName = 'Arial';
    0019             TextFont.FontWeight = 'normal';
    0020             TextFont.FontAngle = 'normal';
    0021             TextFont.FontUnits = 'points';
    0022             TextFont.FontSize = 8;
    0023         end
    0024
    0025         for m1=1:size(flx,1)
    0026             if abs(flx(m1,k)) > Thresh
    0027                 x = abs(flx(m1,k));
    0028                 n=0;
    0029                 while (floor(x*10^n)~=x*10^n)
    0030                     n=n+1;
    0031                 end
    0032                 if n || n<1
    0033                     txtstr = '%.2f';
    0034                 else
    0035                     txtstr = '%d';
    0036                 end
    0037                 text(idxt(m1),idyt(m1)+(idht(m1)./2)...
    0038                     ,num2str(abs(flx(m1,k)),txtstr)...
    0039                     ,'FontSize',TextFont.FontSize,'FontName',...
    0040                     TextFont.FontName,'FontWeight',...
    0041                     TextFont.FontWeight,'FontAngle',...
    0042                     TextFont.FontAngle,'FontUnits',...
    0043                     TextFont.FontUnits,'Parent',h1,'Color'...
    0044                     ,TextCol)
    0045             else
    0046                 text(idxt(m1),idyt(m1)+(idht(m1)./2)...
    0047                     ,num2str(0)...
    0048                     ,'FontSize',TextFont.FontSize,'FontName',...
    0049                     TextFont.FontName,'FontWeight',...
    0050                     TextFont.FontWeight,'FontAngle',...
    0051                     TextFont.FontAngle,'FontUnits',...
    0052                     TextFont.FontUnits,'Parent',h1,'Color'...
    0053                     ,[1,0,0])
    0054             end
    0055         end
    0056
    0057     case 'Two'
    0058
    0059        if isempty(TextFont) % Set default properties
    0060             TextFont.FontName = 'Arial';
    0061             TextFont.FontWeight = 'normal';
    0062             TextFont.FontAngle = 'normal';
    0063             TextFont.FontUnits = 'points';
    0064             TextFont.FontSize = 7;
    0065        end
    0066         for m1=1:size(flx,1)
    0067             if abs(flx(m1,k)) > Thresh
    0068                 x = abs(flx(m1,k));
    0069                 n=0;
    0070                 while (floor(x*10^n)~=x*10^n)
    0071                     n=n+1;
    0072                 end
    0073                 if n || n<1
    0074                     txtstr = '%.2f';
    0075                 else
    0076                     txtstr = '%d';
    0077                 end
    0078                 text(idxt(m1)+idwt(m1)./6,idyt(m1)+5,...
    0079                     num2str(abs(flx(m1,k)),txtstr),...
    0080                     'FontSize',TextFont.FontSize,'FontName',...
    0081                     TextFont.FontName,'FontWeight',...
    0082                     TextFont.FontWeight,'FontAngle',...
    0083                     TextFont.FontAngle,'FontUnits',...
    0084                     TextFont.FontUnits,'Parent',h1,'Color'...
    0085                     ,TextCol)
    0086             else
    0087                 text(idxt(m1)+idwt(m1)./3,idyt(m1)+5,...
    0088                     num2str(0),...
    0089                     'FontSize',TextFont.FontSize,'FontName',...
    0090                     TextFont.FontName,'FontWeight',...
    0091                     TextFont.FontWeight,'FontAngle',...
    0092                     TextFont.FontAngle,'FontUnits',...
    0093                     TextFont.FontUnits,'Parent',h1,'Color'...
    0094                     ,[1,0,0])
    0095             end
    0096                 % For 2nd set (lower)
    0097             if abs(flx(m1,k+1)) > Thresh
    0098                 x = abs(flx(m1,k));
    0099                 n=0;
    0100                 while (floor(x*10^n)~=x*10^n)
    0101                     n=n+1;
    0102                 end
    0103                 if n || n<1
    0104                     txtstr = '%.2f';
    0105                 else
    0106                     txtstr = '%d';
    0107                 end
    0108                 text(idxt(m1)+idwt(m1)./6,idyt(m1)+idht(m1)-4,...
    0109                     num2str(abs(flx(m1,k+1)),txtstr),'FontSize',...
    0110                     TextFont.FontSize,'FontName',TextFont.FontName,...
    0111                     'FontWeight',TextFont.FontWeight,...
    0112                     'FontAngle',TextFont.FontAngle,'FontUnits',...
    0113                     TextFont.FontUnits,'Parent',h1,'Color'...
    0114                     ,TextCol)
    0115             else
    0116                 text(idxt(m1)+idwt(m1)./3,idyt(m1)+idht(m1)-4,...
    0117                     num2str(0),'FontSize',...
    0118                     TextFont.FontSize,'FontName',TextFont.FontName,...
    0119                     'FontWeight',TextFont.FontWeight,...
    0120                     'FontAngle',TextFont.FontAngle,'FontUnits',...
    0121                     TextFont.FontUnits,'Parent',h1,'Color'...
    0122                     ,[1,0,0])
    0123             end
    0124         end
    0125 end