%  _______ 3D  Peaks + Cylind + Kegel  with   ''moving'' PColorBar ___
%  ________________________________________________
close all; clear all; clf;
disp(['°°°°°°°°°°°°° S T A R T °°°°°°°°°°°° ' ,date, ' °°°°°°°°°°°°°°'])
format compact
% :::::::::::::::::::::
set(gcf, 'doublebuffer', 'on')
subplot(221)
axis ('off')
% :::::::::::::::::::::::::::::::.
h = 100; 
ri = 30;
ra = 31;
num = 50;
% :::::::::: basic data :::::::::::..
tht = linspace(0,2*pi, num);
z = linspace(0,h,20);

% Create ''inner'' cylinder
[th, zz] = meshgrid(tht, z);
xi = ri*cos(th);
yi = ri*sin(th);
zi = zz;
% ::::::::::::::::::: Deckel ::::::::::::::::
xtop = xi(1,:)*0;
ytop = yi(1,:)*0;
ztop = zi(end,:);
xi = [xi; xtop];
yi = [yi; ytop];
zi = [zi; ztop];
% Create ''outer'' cylinder
xa = ra*cos(th);
ya = ra*sin(th);
za = 5+zz*0.9;

colormap(winter(num));
% :::::::::::::::::
subplot(222)
     surf(xa,ya,za,'Facecolor', 'none');
     hold on
     mh = mesh(xi,yi,zi, 'Facecolor', 'flat');
     set(mh, 'EdgeColor', 'none')
     set(gca, 'color', 'none')
     title('\bf  Regentonne')
     view(-6,22)
     pause(1)
     [cmin cmax] = Caxis;
     % :::::::::::::::::::: PCOLORbar ::::::::::::::::
     Posi = [0.92, 0.6, 0.05,0.3];
     ax2 = axes('Position',Posi);
     X = 0:1;
     Y =  linspace(0, h,10);  
     icolor = [Y;Y]';  

     for k = 10:-1:0;
         set(mh, 'Zdata', k*zi/10);
         PC = pcolor(X,Y, icolor);
         set(PC, 'EdgeColor','none');
         set(gca,'xtick',[])
         M = colormap;
         colormap(M([end 1 : end-1], :))
         drawnow
         pause(0)
    end
pause(1)
