|
30 | 30 | % To Do
|
31 | 31 |
|
32 | 32 | % Modifications
|
| 33 | +% SA The value of 'majors' at the final plot is fixed to 10 to avoid tick |
| 34 | +% label interruption |
33 | 35 |
|
34 | 36 | % Modifiers
|
35 | 37 | % (SA) Shahab Afshari
|
36 | 38 |
|
37 | 39 | function hfinal = ternplot_pro(dataA,dataB,dataC,num_axes_steps,num_color_classes)
|
38 |
| - |
39 | 40 | % preliminary effort for getting the indices of values of verticies and faces of
|
40 | 41 | % each triangular cell generated according to desired number of axial steps
|
41 | 42 | h0 = figure;
|
42 | 43 | elev = zeros(num_axes_steps,1);
|
43 | 44 | experimental = [linspace(0,1,num_axes_steps)',linspace(1,0,num_axes_steps)',elev];
|
44 |
| -h = ternpcolor(experimental(:, 1)', experimental(:, 2)', experimental(:, 3)',num_axes_steps); |
| 45 | +%%%% |
| 46 | +Z = experimental(:, 3)'; |
| 47 | +[fA, fB, fC] = fractions(experimental(:, 1)', experimental(:, 2)', experimental(:, 3)'); |
| 48 | +[x, y] = terncoords(fA, fB, fC); |
| 49 | +% Sort data points in x order |
| 50 | +[x, i] = sort(x); |
| 51 | +y = y(i); |
| 52 | +Z = Z(i); |
| 53 | +% The matrixes we work with should be square for the triangulation to work |
| 54 | +N = num_axes_steps+1; |
| 55 | +% Now we have X, Y, Z as vectors. |
| 56 | +% use meshgrid to generate a grid |
| 57 | +Ar = linspace(min(fA), max(fA), N); |
| 58 | +Br = linspace(min(fB), max(fB), N); |
| 59 | +[Ag, Bg] = meshgrid(Ar, Br); |
| 60 | +[xg, yg] = terncoords(Ag, Bg); |
| 61 | +% ...then use griddata to get a plottable array |
| 62 | +zg = griddata(x, y, Z, xg, yg, 'v4'); |
| 63 | +zg(Ag + Bg > 1) = nan; |
| 64 | +% Make ternary axes |
| 65 | +[hold_state, cax, next] = ternaxes(num_axes_steps); |
| 66 | +% plot data |
| 67 | +tri = simpletri(N); |
| 68 | +h = trisurf(tri, xg, yg, zg); |
| 69 | +view([-37.5, 30]); |
| 70 | +if ~hold_state |
| 71 | + set(gca,'dataaspectratio',[1 1 1]), axis off; |
| 72 | + set(cax,'NextPlot',next); |
| 73 | +end |
| 74 | +view(0, 90); |
45 | 75 | h.FaceColor = 'none';
|
46 | 76 | v = h.Vertices;
|
47 | 77 | f = h.Faces;
|
48 | 78 | close(h0)
|
49 |
| - |
| 79 | +clear fA fB fC x y N Ag Bg Ar Br xg yg hold_state cax next |
| 80 | +%%%% |
50 | 81 | f2 = f;
|
51 | 82 | f2(ismember(f2(:,1),find(isnan(v(:,3)))),:)=[];
|
52 | 83 | f2(ismember(f2(:,2),find(isnan(v(:,3)))),:)=[];
|
|
74 | 105 | %
|
75 | 106 | % Plotting Ternary Diagram
|
76 | 107 | hfinal = figure;
|
77 |
| -ternplot(dataA, dataB, dataC,num_axes_steps,'.','color','none') |
| 108 | +ternplot(dataA, dataB, dataC,'majors', 10,'.','color','none') % here the 'majors' is fixed to 10 to avoid text-lable interruption. |
78 | 109 | set(gca, 'visible', 'off');
|
79 | 110 | hold on
|
80 | 111 | for i = 1: size(f2,1)
|
|
94 | 125 | h_colbar = colorbar('XTickLabel',{num2str(round(c_mat_down,2));...
|
95 | 126 | modified_color_bar}, ...
|
96 | 127 | 'XTick',linspace(0,1,num_color_classes)','location','eastoutside');
|
97 |
| -ylabel(h_colbar,['Density of AHG (% of Tot. Counts),','Tot. Counts =', num2str(length(dataA))],'fontsize',10,'rotation',90) |
| 128 | +ylabel(h_colbar,['Density (% of Tot. Counts),','Tot. Counts =', num2str(length(dataA))],'fontsize',10,'rotation',90) |
98 | 129 | set(gca, 'visible', 'off');
|
99 |
| -ht = ternlabel('b^{*}', 'f^{*}', 'm^{*}'); |
| 130 | +%ht = ternlabel('b^{*}', 'f^{*}', 'm^{*}'); |
100 | 131 | % h_text = ternlabel('b', 'f', 'm');
|
101 | 132 | % h_text(1).FontSize = 14;
|
102 | 133 | % h_text(2).FontSize = 14;
|
|
0 commit comments