Skip to content

Commit 160dd6a

Browse files
committed
Code cleanup
1 parent ccaf5df commit 160dd6a

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

ternplot_pro.m

+12-13
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,23 @@
8888
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8989

9090
total_data_count = length(dataA);
91-
% counting points located within polygon extent
92-
for i = 1: size(f2,1)
93-
94-
inpoly_data_count = inpolygon(x, y,v(f2(i,:),1),v(f2(i,:),2));
95-
density_i(i,1) = sum(inpoly_data_count)/total_data_count;
96-
91+
% count points located within polygon extent
92+
for i = 1:size(f2, 1)
93+
inpoly_data_count = inpolygon(x, y, v(f2(i, :), 1), v(f2(i, :), 2));
94+
density_i(i, 1) = sum(inpoly_data_count)/total_data_count;
9795
end
9896
%
99-
% specifying the RGB ranges of the colorbar (here grey scale is applied)
97+
% specify the RGB ranges of the colorbar (here grey scale is applied)
10098
c_mat_down = 0;
101-
c_mat_up = round(1.05*max(density_i),2,'significant');
102-
c_mat = [linspace(1,0,num_color_classes-1)',linspace(1,0,num_color_classes-1)',linspace(1,0,num_color_classes-1)'];
103-
c_mat_1 = linspace(c_mat_down,c_mat_up,size(c_mat,1)+1)';
104-
c_mat = [c_mat_1(1:end-1),c_mat_1(2:end),c_mat];
99+
c_mat_up = round(1.05*max(density_i), 2, 'significant');
100+
c_mat = repmat(linspace(1, 0, num_color_classes-1)', 1, 3);
101+
c_mat_1 = linspace(c_mat_down, c_mat_up, size(c_mat,1) + 1)';
102+
c_mat = [c_mat_1(1:end-1), c_mat_1(2:end), c_mat];
105103
%
106-
% Plotting Ternary Diagram
104+
% Plot Ternary Diagram
107105
hfinal = figure;
108-
ternplot(dataA, dataB, dataC,'majors', 10,'.','color','none') % here the 'majors' is fixed to 10 to avoid text-lable interruption.
106+
% here the 'majors' is fixed to 10 to avoid text-lable interruption.
107+
ternplot(dataA, dataB, dataC, 'majors', 10, '.', 'color', 'none')
109108
set(gca, 'visible', 'off');
110109
hold on
111110
for i = 1: size(f2,1)

0 commit comments

Comments
 (0)