function topicEvolution(topicProbs,topics)

idx = topicProbs > 0.36;
topicnum = nan(length(topicProbs),1);
topicnum(idx(:,1)) = ones(sum(idx(:,1)),1);
topicnum(idx(:,2)) = 2*ones(sum(idx(:,2)),1);
topicnum(idx(:,3)) = 3*ones(sum(idx(:,3)),1);
topicnum(idx(:,4)) = 4*ones(sum(idx(:,4)),1);

[topicnum, TF] = rmmissing(topicnum);
topicProbs = topicProbs(~TF,:);
topicProbs(topicnum == 4,1) = topicProbs(topicnum==4,4);
topicProbs(topicnum == 3,1) = topicProbs(topicnum==3,3);
topicProbs(topicnum == 2,1) = topicProbs(topicnum==2,2);
topicProbs(topicnum == 1,1) = topicProbs(topicnum==1,1);
topicProbs = topicProbs(:,1);

cols = {'r','b','k','g'};
figure('Color','white')
figure('Visible','on','Color','white')
h = axes;
h.XLim = [0 120];
h.YLim = [0.4 1];

% Custom legend
plot(NaN,NaN,'or','MarkerFaceColor','r'); hold on
plot(NaN,NaN,'ob','MarkerFaceColor','b'); hold on
plot(NaN,NaN,'ok','MarkerFaceColor','k'); hold on
plot(NaN,NaN,'og','MarkerFaceColor','g'); hold on


for i = 1:length(topicProbs)
    plot(h, i, topicProbs(i), 'o', 'MarkerSize', 10*topicProbs(i), ...
        'MarkerFaceColor', cols{topicnum(i)},'MarkerEdgeColor', cols{topicnum(i)})
    h.XLim = [0 160];
    h.YLim = [0.4 1];
%     text(i, topicProbs(i), [' ' char(topics(topicnum(i)))])
    hold on
    pause(0.1)  
end
title('Topic evolution in SEC filing')
xlabel('Sentence No.')
ylabel('Topic Probability')
legend(topics)

end
