spineDataPlot
Draw your data in the space it lives in, coloured by score.
Objects are drawn in increasing order of score, so the atypical ones are never buried under the bulk. Colour limits are fixed at 0 to 1, so two figures can be compared by eye.
Syntax and options
help spineDataPlot
SPINE Data Plot
Draw your data in the space it lives in, coloured by score.
fig = spineDataPlot(Result)
fig = spineDataPlot(Result, 'Title', 'my sites', 'View', [35 20])
One feature is drawn as value against object, two as a scatter, three as a
rotatable 3-D scatter, and more are projected onto their first two principal
components with the axes labelled to say so.
Scores run from 0, the typical stratum, to 1, the most atypical. Colour
limits are fixed at [0, 1] so two figures can be compared by eye, and the
colour bar is ticked at the strata themselves, with their populations, so it
doubles as the legend.
Objects are drawn in increasing order of score, so the atypical ones are
never hidden underneath the bulk.
Options
'Width' figure width in millimetres (default 120)
'Height' figure height in millimetres (default 108)
'Title' text above the axes
'ColourBy' "score" (default) or "stratum". Switch to "stratum" when
the scores bunch together and two strata would otherwise be
drawn in near-identical colours: it spaces the strata evenly
and labels the bar accordingly, so nothing is misread as a
score. ColorBy is accepted as well.
'Projection' "pca" (default) or "none", for four or more features
'View' [azimuth elevation] for 3-D data (default [40 22])
'MarkerScale' multiplier on marker area (default 1)
For the companion figure showing the measure and the profile behind the cuts,
see spinePlot.
Uses base MATLAB only.
Author
Abd AlRahman AlMomani
Assistant Professor of Data Science and Mathematics, ERAU, AZ
almomaniar@gmail.com
Two features
D = [randn(200,2); [12 12] + 0.25*randn(20,2)];
[~, R2] = spine(D, 'dist2median', "upper");
spineDataPlot(R2, 'Title', 'two features');
One feature
Value against object, in the order you supplied.
v = [abs(randn(120,1)); abs(randn(8,1)) + 9];
[~, R1] = spine(v, 'asis', "upper");
spineDataPlot(R1, 'Title', 'one feature');
Three features
A real 3-D axes: drag it to rotate when you run this yourself.
U = randn(20,3); U = U ./ sqrt(sum(U.^2,2));
X3 = [0.9*randn(150,3); U .* (25 + 2*randn(20,1))];
[~, R3] = spine(X3, 'dist2median', "upper");
spineDataPlot(R3, 'Title', 'three features');
More than three
The first two principal components, with the axes labelled to say so and the variance explained in the title. Nothing about the partition changes; only the drawing is a projection.
X12 = [randn(240,12); randn(18,12) + 5];
[~, R12] = spine(X12, 'robustrownorm', "upper");
spineDataPlot(R12, 'Title', 'twelve features');
When the scores bunch together
Three strata scoring 0, 0.18 and 1 come out as two nearly identical shades and one dark one. 'ColourBy', "stratum" spaces them evenly instead and labels the bar stratum, so nothing is misread as a score.
spineDataPlot(R3, 'Title', 'coloured by stratum', 'ColourBy', "stratum");
See also
spinePlot for where the cuts came from, spineNetworkPlot for graphs, and spineScoreMap if you are drawing your own.