2

I am trying to visualize Gaussian mixture Model's contour lines to my scatter plots but they do not show up properly, first I thought they are getting overlapped by the points but the problem persists even if I draw the lines first and then plot the scatter points.

My code to generate the plots:

mn = min(pcaX); mx = max(pcaX);
for i = 1:6
    subplot(2,3,i);
    gscatter(pcaTest(:,1), pcaTest(:,2), testLabels);
    hold on;
    ezcontour(@(x,y)pdf(models{i},[x y]), [mn(1) mx(1) mn(2) mx(2)]);
    hold off, axis xy, title(['For class ',int2str(i),'components:',int2str(models{i}.NumComponents)]), xlabel('PC1'), ylabel('PC2');
end

That's how it looks: Notice the cut in contour lines

current plot result

zeeMonkeez
  • 5,057
  • 3
  • 33
  • 56
Sudh
  • 1,265
  • 2
  • 19
  • 30
  • Can you generate dummy data for a [minimum working example](http://stackoverflow.com/help/mcve)? I need `pcaTest`, `pcaX`, `testLabels`, and `models`. – krisdestruction Apr 18 '15 at 07:12

1 Answers1

0

I wasn't able to construct your problem even with ezcontour, but replacing it with fcontour may do the job:

fcontour

EBH
  • 10,350
  • 3
  • 34
  • 59