function addmax(varargin)
if length(varargin)>0 && strcmp(varargin,'rows')
    dimension = 2;
else
    dimension = 1;
end

chil=get(gca,'children');
z = get(chil(1),'CData');
x = get(chil(1),'XData');
[maxind, maxind] = max(z,[],dimension);

if length(x) == 2
    x = x(1):x(2);
end

hold on
m = plot(x, maxind, '.k','Erasemode','xor')
hold off
