function gpt4plot(firstdat,lastdat,colours,opts,enhance)
%
% function gpt4plot(firstdat,lastdat,colours,opts,enhance)
%
%    GPT4PLOT - Plot GPT data set in 2x2 plot

    npart = size(firstdat,1) ;

    if ( nargin < 5 ) || ( isempty(enhance) )
        enhance = 0 ;
    end

    if ( nargin < 4 ) || ( isempty(opts) )
        opts = 0 ;
    end

    if ( nargin < 3 ) || ( isempty(colours) )
        for i = 1:npart
            colours(i,:) = 'xk-' ;
        end
    elseif ( size(colours,1) == 1 )
        colour = colours ;
        for i = 1:npart
            colours(i,:) = colour ;
        end
    end

    if opts ~= 0
        optcond = (['lastdat(i,5) ' opts]) ;
    else
        optcond = '1' ;
    end

%    figure ;
    subplot(2,2,1), hold on ;
    xlabel(['x (mm)']), ylabel(['y (mm)']) ;
    for i = 1:npart
        if eval(optcond)
            plot(firstdat(i,1).*1e3,firstdat(i,3).*1e3,colours(i,1:2)) ;
        end
    end ; hold off ;
    if ( strcmp(enhance,'enhance') )
        jpgplot ;
    end

    subplot(2,2,2), hold on ;
    xlabel(['x'' (mrad)']), ylabel(['y'' (mrad)']) ;
    for i = 1:npart
        if eval(optcond)
            plot(firstdat(i,2).*1e3,firstdat(i,4).*1e3,colours(i,1:2)) ;
        end
    end ; hold off ;
    if ( strcmp(enhance,'enhance') )
        jpgplot ;
    end

    subplot(2,2,3), hold on ;
    xlabel(['x (mm)']), ylabel(['x'' (mrad)']) ;
    for i = 1:npart
        if eval(optcond)
            plot(firstdat(i,1).*1e3,firstdat(i,2).*1e3,colours(i,1:2)) ;
        end
    end ; hold off ;
    if ( strcmp(enhance,'enhance') )
        jpgplot ;
    end

    subplot(2,2,4), hold on ;
    xlabel(['y (mm)']), ylabel(['y'' (mrad)']) ;
    for i = 1:npart
        if eval(optcond)
            plot(firstdat(i,3).*1e3,firstdat(i,4).*1e3,colours(i,1:2)) ;
        end
    end ; hold off ;
    if ( strcmp(enhance,'enhance') )
        jpgplot ;
    end

    return

