plotDataPoints.m 434 B

1234567891011121314
  1. function plotDataPoints(X, idx, K)
  2. %PLOTDATAPOINTS plots data points in X, coloring them so that those with the same
  3. %index assignments in idx have the same color
  4. % PLOTDATAPOINTS(X, idx, K) plots data points in X, coloring them so that those
  5. % with the same index assignments in idx have the same color
  6. % Create palette
  7. palette = hsv(K + 1);
  8. colors = palette(idx, :);
  9. % Plot the data
  10. scatter(X(:,1), X(:,2), 15, colors);
  11. end