function fig = plot_aperture_phase(X,Y,E,a_pos,flagged)
    fig = figure;
    power = 10*log10(abs(E));
    mask = zeros(size(E));
    mask(power < -10) = 1;
    phase = angle(E);
    phase(find(mask)) = NaN;
    pcolor(X,Y,180/pi*(phase));
    title('Aperture Image, Phase in Degrees');
    shading flat
    axis equal
    axis tight
    caxis([-180,180])
    xlabel('East/m');
    ylabel('North/m');
    hold on
    plot(a_pos(:,1),a_pos(:,2),'o','Color','black','MarkerSize',10);
    for k = 1:length(flagged)
        u = flagged(k);
        plot(a_pos(u,1),a_pos(u,2),'x','Color','black','MarkerSize',10);
    end
    cb = colorbar;
    cb.TickLabelInterpreter = 'latex';
    hold on
  
    
end
