function tx = figm_label(string,loc,fsz,offset,offset2,xbox,ybox)
% function tx = fig_label(string,loc,fsz,offset)
%   puts string='a.' at loc
%   loc is string ll,lr,ul,ur
% fsz is fontsize (default 10)
% offset is fraction of distance from corner (default 0.05);

if nargin < 3
    fsz = 10;
end;

if nargin < 4
    offset = 0.05;
end;

if nargin < 5
   offset2 = offset+0.05;
end

if nargin < 6
    xbox = 1;
end

if nargin < 7
    ybox = 1;
end

xlm = get(gca,'xlim');
ylm = get(gca,'ylim');
if strcmp(loc,'ll');
    x = xlm(1)+offset*(diff(xlm));
    y = ylm(1)+offset2*(diff(ylm));
elseif strcmp(loc,'lr')
    x = xlm(2)-(offset+0.05)*(diff(xlm));
    y = ylm(1)+offset2*(diff(ylm));
elseif strcmp(loc,'ul')
    x = xlm(1)+offset*(diff(xlm));
    y = ylm(2)-offset2*(diff(ylm));
    patch([xlm(1)+3000 xlm(1)+xbox xlm(1)+xbox xlm(1)+3000],[ylm(2)-ybox ylm(2)-ybox ylm(2)-2250 ylm(2)-2250],'white')
elseif strcmp(loc,'ur')
    x = xlm(2)-(offset+0.05)*(diff(xlm));
    y = ylm(2)-offset2*(diff(ylm));
else
    error(['unknown location: ' loc]);
end;

tx = text(double(x),double(y),string,'fontweight','bold','fontsize',fsz);