function test_pcolor

    %Flags zur Demonstration...
    flagHighRes=0; %hohe Aufloesung
    flagDefGrid=1; %Gitter vorgeben

    disp([char(10) '### Here we go... ###']);

    d=2; xp=0; yp=0; N=1000; size=500; %max. It. -> see below!!!

    xp=-0.748650029; yp=0.074105922;
    if flagHighRes==0, d=0.5e-006; else d=1.0e-014; end;

    handles.size=size;
    handles.N=N;
    handles.flag=flagDefGrid;
    
    % Update handles structure
    guidata(gcf,handles); % store

    zm=zoom;
    set(zm,'ActionPostCallback',@zoompostcallback);
    set(zm,'Enable','on');

    drawMandelbrot(xp,yp,d,size,N);

function drawMandelbrot(xp,yp,d,size,N,flag)
    handles=guidata(gcf);
    disp(' ');

    lf=xp-d; rt=xp+d; dn=yp-d; up=yp+d;
    len=max(rt-lf,up-dn); h=len/size;

    X=lf:h:rt; Y=dn:h:up;

    %huh... debug...
    lenX=length(X); lenY=length(Y); m=1; n=1;
    if lenX>lenY, X=X(1:lenY); lenX=lenY;
    elseif lenY>lenX, Y=Y(1:lenX); lenY=lenX;
    end
    C=N*ones(lenX,lenY);

    tic;
    for x=X
        for y=Y
            q=(x-1/4)^2+y^2;
            if (q*(q+(x-1/4))>y^2/4)&&((x+1)^2+y^2>1/16)
                C(m,n)=apfelmaennchen([x y],N);
            end, m=m+1;
        end;
        m=1; n=n+1;
    end
    toc

    tic;
    if handles.flag==1, pcolor(X,Y,C); else pcolor(C); end
    toc

    shading interp;
    set(gca,'PlotBoxAspectRatioMode','manual');
    set(gca,'DataAspectRatioMode','manual');
    set(gca,'DataAspectRatio',[1 1 1]);

    disp(['New center at: (' num2str((lf+rt)/2) ',' num2str((up+dn)/2) '), d: ' num2str((rt-lf)/2)]);
    
function iter=apfelmaennchen(c,N)
    iter=0; x=c(1); y=c(2);
    while (iter<N)&&(x^2+y^2<4),
        tmp=x^2-y^2+c(1);
        y=2*x*y+c(2);
        x=tmp;
        iter=iter+1;
    end
    
function zoompostcallback(~,evd)
    handles=guidata(gcf);
    
    newLimX = get(evd.Axes,'XLim');
    newLimY = get(evd.Axes,'YLim');
    
    lf=newLimX(1); rt=newLimX(2);
    dn=newLimY(1); up=newLimY(2);
    
    xp=(lf+rt)/2; yp=(dn+up)/2; d=max(rt-lf,up-dn)/2;
    size=handles.size; N=handles.N;
    
    drawMandelbrot(xp,yp,d,size,N);