diff --git a/ternplot_pro.m b/ternplot_pro.m index 0af97ea..a3a3a10 100644 --- a/ternplot_pro.m +++ b/ternplot_pro.m @@ -88,24 +88,23 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% total_data_count = length(dataA); -% counting points located within polygon extent -for i = 1: size(f2,1) - -inpoly_data_count = inpolygon(x, y,v(f2(i,:),1),v(f2(i,:),2)); -density_i(i,1) = sum(inpoly_data_count)/total_data_count; - +% count points located within polygon extent +for i = 1:size(f2, 1) + inpoly_data_count = inpolygon(x, y, v(f2(i, :), 1), v(f2(i, :), 2)); + density_i(i, 1) = sum(inpoly_data_count)/total_data_count; end % -% specifying the RGB ranges of the colorbar (here grey scale is applied) +% specify the RGB ranges of the colorbar (here grey scale is applied) c_mat_down = 0; -c_mat_up = round(1.05*max(density_i),2,'significant'); -c_mat = [linspace(1,0,num_color_classes-1)',linspace(1,0,num_color_classes-1)',linspace(1,0,num_color_classes-1)']; -c_mat_1 = linspace(c_mat_down,c_mat_up,size(c_mat,1)+1)'; -c_mat = [c_mat_1(1:end-1),c_mat_1(2:end),c_mat]; +c_mat_up = round(1.05*max(density_i), 2, 'significant'); +c_mat = repmat(linspace(1, 0, num_color_classes-1)', 1, 3); +c_mat_1 = linspace(c_mat_down, c_mat_up, size(c_mat,1) + 1)'; +c_mat = [c_mat_1(1:end-1), c_mat_1(2:end), c_mat]; % -% Plotting Ternary Diagram +% Plot Ternary Diagram hfinal = figure; -ternplot(dataA, dataB, dataC,'majors', 10,'.','color','none') % here the 'majors' is fixed to 10 to avoid text-lable interruption. +% here the 'majors' is fixed to 10 to avoid text-lable interruption. +ternplot(dataA, dataB, dataC, 'majors', 10, '.', 'color', 'none') set(gca, 'visible', 'off'); hold on for i = 1: size(f2,1)