0

I have a 151-by-200 matrix, let's say D, where rows are patients and cols are some features.

After using pdist and mdscale I obtain a 151-by-3 matrix. I also used some consensus clustering algorithm and obtained the partitioning of the patients.

Now I would like to plot the distribution of the mdscaled matrix of points, each one with a shape and a colour (where shapes indicates classes and colors clusters ) as in the image below.

Can you give me an hint on how to do it? Thank you.

plot

Amro
  • 123,847
  • 25
  • 243
  • 454
Fujitina
  • 129
  • 1
  • 2
  • 16
  • 1
    There are a lot of questions which should give you a good idea how to start: http://stackoverflow.com/questions/18091728/k-means-cluster-plot http://stackoverflow.com/questions/16438080/k-means-plotting-for-3-dimensional-data http://stackoverflow.com/questions/14006678/creating-legend-for-scatter3-plot-matlab – Daniel Mar 24 '16 at 20:53

1 Answers1

1

Here is an example how to plot grouped 3D points:

% data and clusters
load fisheriris
X = meas(:,1:3);
[L,~,Y] = unique(species);

% colors and markers of each group
colors = hsv(numel(L));
markers = 'osdv^x*+.><ph';

% plot
for i=1:numel(L)
    ind = (Y == i);
    h(i) = line(X(ind,1), X(ind,2), X(ind,3), ...
        'LineStyle','none', 'LineWidth',1, 'MarkerSize',8, ...
        'Marker',markers(i), 'Color',colors(i,:), ...
        'MarkerEdgeColor','k', 'MarkerFaceColor',colors(i,:));
end
view(-150,30), axis vis3d, grid on, box on
legend(h, L, 'Location','northeast')
title('MultiDimensional Scaling')
xlabel('dim1'), ylabel('dim2'), zlabel('dim3')

plot

You can customize the shapes and colors to match your criteria ("shapes indicates classes and colors clusters").

Amro
  • 123,847
  • 25
  • 243
  • 454