function []=mode_plot(mode_num,kh,cdfr,FREQ,zr,case_name)
% Plot the specified mode function and annotate with the real and
% imaginary parts of the horizontal wave number. The latter is 
% coverted to dB/m.
cmin=min(real(cdfr(:,mode_num)));
cmax=max(real(cdfr(:,mode_num)));
% Put anotation in the middle
right =  cmax - (cmax-cmin)/2.0;
zmin=min(zr);
zmax=max(zr);
upnm = zmax - (zmax-zmin)/24.0;
uprkh = zmax - (zmax-zmin)/12.0;
upikh = zmax - (zmax-zmin)/8.0;
figure;
plot(real(cdfr(:,mode_num)),zr,'b-');
hold on;
plot(imag(cdfr(:,mode_num)),zr,'r--');
%
title(case_name);
mode_num_text = sprintf('Mode # %d',mode_num);
text(right,upnm,mode_num_text);
rkh_text = sprintf('Re(kh)= %7.5f 1/m',real(kh(mode_num)));
text(right,uprkh,rkh_text);
% Convert neepers per meter to dB/m
ikhdB=20*log10(exp(1))*imag(kh(mode_num));
ikh_text = sprintf('Im(kh)= %0.5g dB/m',ikhdB);
%ikh_text = sprintf('Im(kh)= %0.5g nepers/m',imag(kh(mode_num)));
%ikh_text = sprintf('Im(kh)= %0.5g 1/m',imag(kh(mode_num)));
text(right,upikh,ikh_text);
set(gca,'ydir','reverse');
hold off;