123456789101112131415161718192021222324252627282930313233343536373839404142 |
- % PlotValueMatrix.m
- %
- % This function plots the provided value matrix. The columns are plotted
- % in the X axis and the rows in the Y axis.
- function PlotValueMatrix(matrix)
- numValues = sum(matrix,1); % columnwise summation
- sumMatrix = matrix;
- for i=1:size(matrix,1)
- sumMatrix(i,:) = matrix(i,:) * i;
- end
- sumValues = sum(sumMatrix, 1);
- meanValues = sumValues./numValues;
- percMatrix = matrix;
- for i=1:size(matrix,2)
- percMatrix(:,i) = matrix(:,i)./numValues(i);
- end
- figure;
- hold on;
- if (size(matrix,1) > 2)
- maxTarSize = 120;
- else
- maxTarSize = 50;
- end
- colors = {'r'; 'g'; 'y'; 'k'; 'm'};
- for i=1:size(percMatrix,1)
- for j=1:size(percMatrix,2)
- markerSize = percMatrix(i,j)*maxTarSize;
- if (markerSize < 1)
- continue;
- end
- plot(j, i, '.', 'color', colors{j,1}, 'markerSize', markerSize);
- end
- end
- meanTarSize = 30;
- p = plot(meanValues, '.-b', 'markersize', meanTarSize);
- h = plot(-1, -1, '.r', 'markerSize', meanTarSize);
- legend([h p], {'Μέγεθος δείγματος ανα στήλη στον άξονα Χ', 'Μέση τιμή'}, 'location', 'northeast');
- box on;
- end
|