forked from helgestein/htAx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotTernData.m
110 lines (86 loc) · 2.92 KB
/
plotTernData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
function [] = plotTernData(ternHandles, specHandles, ECHandles)
%PLOTTERNDATA call using PLOTTERNDATA(TERNHANDLES, SPECHANDLES,
%ECHANDLES)
figTern = ternHandles.fTernDiagram;
ternInfo = figTern.UserData;
ternPlotType = ternInfo.ternPlotType;
numTernPoints = ternInfo.numPoints;
numSelected = ternInfo.numSelected;
pointInfo = ternInfo.pointInfo;
hEditSize = ternHandles.editSize;
dotSize = hEditSize.UserData;
figSpec = specHandles.fSpecPlot;
specInfo = figSpec.UserData;
XRDData = specInfo.XRDData;
angleIndex = specInfo.angleIndex;
figEC = ECHandles.fECPlot;
ECInfo = figEC.UserData;
ECData = ECInfo.ECData;
valSliderECPot = ECInfo.valSliderECPot;
% plot gridlines
figure(figTern);
hold off;
plotTernBase(ternInfo.axesTernary, ternInfo.labels);
%hold off;
%axis image;
%axis off;
hold on;
% highlight the appropriate region
if ternPlotType ~= 1
if ternPlotType ~= 3
if ishandle(ternInfo.highlight) == 1
delete(ternInfo.highlight);
end
hEditConst = ternHandles.editConst;
hEditWidth = ternHandles.editWidth;
ternInfo.highlight = plotTernHighlight(figTern, 1000, ...
hEditConst.UserData, hEditWidth.UserData, ...
ternInfo.constType);
figTern.UserData = ternInfo;
end
end
ternInfo = figTern.UserData;
% plot the selected data
if ternPlotType == 0
plotTernScatter(ternInfo.xCoords, ternInfo.yCoords, ...
XRDData(angleIndex, 2 .* (1:numTernPoints)), ...
ternInfo.axesTernary, dotSize);
elseif ternPlotType == 1
plotTernSurf(ternInfo.xCoords, ternInfo.yCoords, ...
XRDData(angleIndex, 2 .* (1:numTernPoints)));
else
toPlot = zeros(1, numTernPoints);
for indexEC = 1:numTernPoints
minIndex = findClosestPot(valSliderECPot, ...
ECData(:, 2 * indexEC - 1));
toPlot(indexEC) = ECData(minIndex, 2 .* indexEC);
end
if ternPlotType == 2
plotTernScatter(ternInfo.xCoords, ternInfo.yCoords, ...
toPlot, ternInfo.axesTernary, dotSize);
else
plotTernSurf(ternInfo.xCoords, ternInfo.yCoords, toPlot);
end
end
% plot the selected points
if numSelected ~= 0
zVals = 100000 * ones(numSelected, 1);
zVal = 100000;
for i = 2:2:numSelected
angle = XRDData(pointInfo(i, 6), 1);
colorSelection = getColorSelection(angle, specInfo.minAngle, ...
specInfo.maxAngle);
hold on;
scatter3(ternInfo.axesTernary, ...
pointInfo(i - 1, 1), pointInfo(i - 1, 2), ...
zVal, 30, colorSelection, 'filled');
scatter3(ternInfo.axesTernary, ...
pointInfo(i, 1), pointInfo(i, 2), ...
zVal, 30, colorSelection, 'filled');
plot3(ternInfo.axesTernary, ...
[pointInfo(i - 1, 1) pointInfo(i, 1)], ...
[pointInfo(i - 1, 2) pointInfo(i, 2)], ...
[zVal zVal], 'Color', colorSelection);
end
end
end