Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alchemyst committed Jun 25, 2016
1 parent ccaf5df commit 160dd6a
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions ternplot_pro.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 160dd6a

Please sign in to comment.