function plotAFS(parentfig, data, AxesAFS, AxesSOL, lcs, LCS)

AFS = data.AFS;
parts = data.parts;
lines = data.lines;
dimP = data.dimP;
lenP = data.lenP;
LENP = data.LENP;
valid = data.valid;
mima = data.mima;
GenInfo = data.GenInfo;

if data.s == 2
    set(parentfig,'CurrentAxes',AxesAFS);
    fill([AFS{1}(1), AFS{1}(2), AFS{1}(2), AFS{1}(1), AFS{1}(1)],...
         [AFS{2}(1), AFS{2}(1), AFS{2}(2), AFS{2}(2), AFS{2}(1)],0.9*[1 1 1]);
    hold(AxesAFS,'on');
    for i=1:2
        plot(AxesAFS,[AFS{1}(i), AFS{1}(i)], [AFS{2}(1), AFS{2}(2)], 'color',lcs(1,:),'Linewidth',2);
        plot(AxesAFS,[AFS{1}(1), AFS{1}(2)], [AFS{2}(i), AFS{2}(i)], 'color',lcs(2,:),'Linewidth',2);
    end
    
    axis(AxesAFS,'tight');
    xl = get(AxesAFS,'xlim');
    yl = get(AxesAFS,'ylim');
    set(AxesAFS,'xlim',[(1-sign(xl(1))*0.1)*xl(1) (1+sign(xl(2))*0.1)*xl(2)],...
        'ylim',[(1-sign(yl(1))*0.1)*yl(1) (1+sign(yl(2))*0.1)*yl(2)]);
else
    plot(AxesAFS,0,0,'w');
    axes(AxesAFS);
    if parts == -3
        lc = [0, 0, 0];
        if valid(1) == 1
            plot(AxesAFS,AFS{1}(:,1),AFS{1}(:,2),'-','color',lc,'Linewidth',2);
            hold(AxesAFS,'on');
        end
        if valid(2) == 1
            plot(AxesAFS,AFS{2}(:,1),AFS{2}(:,2),'--','color',lc,'Linewidth',2);
        end
        if valid(1)*valid(2) == 1
            legend('exterior boundary','interior boundary');
        end
    else        
        for i=1:lines
            if valid(i) == 1
                if parts == 3
                    lc = lcs(i,:);
%                     lcf = (lc > 0)+.8*(lc == 0);
                    lcf = LCS(i,:);
                elseif parts > 3
                    if i <= 6
                        lc = lcs(i,:);
                        lcf = (lc > 0)+.8*(lc == 0);
                    else
                        lc = [0, 0, 0];
                        lcf = (lc > 0)+.8*(lc == 0);
                    end
                else
                    lc = [0, 0, 0];
                    if i==1
                        lcf = (lc > 0)+.8*(lc == 0);
                    else
                        lcf = [1 1 1];
                    end;
                end
                if dimP(i) == 1
                    plot(AxesAFS,AFS{i}(:,1),AFS{i}(:,2),'x','color',lc,'Linewidth',2,'Markersize',10);
                    hold(AxesAFS,'on');
                else
                    fill(AFS{i}(:,1),AFS{i}(:,2),lcf);
                    hold(AxesAFS,'on');
                    plot(AxesAFS,AFS{i}(:,1),AFS{i}(:,2),'color',lc,'Linewidth',2);
                end
            end
        end
    end
    
    plot(AxesAFS,data.InitT(1,2),data.InitT(1,3),'+','color',lcs(1,:),'Linewidth',2);
    plot(AxesAFS,data.InitT(2,2),data.InitT(2,3),'+','color',lcs(2,:),'Linewidth',2);
    plot(AxesAFS,data.InitT(3,2),data.InitT(3,3),'+','color',lcs(3,:),'Linewidth',2);
    
    axis(AxesAFS,'tight');
    xl = get(AxesAFS,'xlim');
    yl = get(AxesAFS,'ylim');
    
    plot(AxesAFS,data.Dpoints(:,1),data.Dpoints(:,2),'o','color',[.6 .6 .6],'Linewidth',1,'Markersize',5);
    
    if (isfield(data,'isimport') == 1) && (data.isimport == 1)
        for i=1:data.import.s
            plot(AxesAFS, data.import.tr(i,1),data.import.tr(i,2),'cx','Linewidth',2,'Markersize',8)
        end
    end
    
    if (isfield(data,'isLastClickLockMode') == 1) && (data.isLastClickLockMode == 1)
        if (isfield(data,'isExpert1') == 1) && (data.isExpert1 == 0)
            plot(AxesAFS, data.LastClickLockMode.FixPoint(1), data.LastClickLockMode.FixPoint(2),'kx','Linewidth',2);
        end
    end
            
    set(AxesAFS,'xlim',1.1*xl,'ylim',1.1*yl);
    xlabel(AxesAFS,'\alpha','interpreter','tex');
    ylabel(AxesAFS,'\beta','interpreter','tex');
end
hold(AxesAFS,'off');
