image thumbnail

Plot color

by

 

13 May 2013 (Updated )

PLOT_COLOR draws a dotted graph where the color of every point depends by vector P

plot_color(X, Y, P, ColorStart, ColorEnd, MarkerSize)
function plot_color(X, Y, P, ColorStart, ColorEnd, MarkerSize)
%PLOT_COLOR
%   PLOT_COLOR draws a bidimensional dotted graph, where the color of every
%   single point of the vectors X, Y depends by vector P (the intensity
%   color, isn't necessary normalize it). 
%   X, Y and P must be vector and must be have same lenght.
%   ColorStart and ColorEnd are the two colours that specifying the
%   fractional position of blending. P determines the point to point
%   percent of colour. 
%   MarkerSize has the same sintax as when using it in the plot.
%
%   BLENDCOLOR.M file required.
%   See: www.mathworks.com/matlabcentral/fileexchange/41691-blend-color 
%
%
%   Author(s): G. Alessandroni, 05-11-13
%   Copyright 2013, University of Urbino
%  

% Rows of lat vector
[n ~] = size(X);

% Normalized power vector
P = P-min(P);
Pn = P/max(P);

% Plot graphics
hold on
for i=1:n
    C = blendcolor(ColorStart, ColorEnd, Pn(i));
    plot(X(i), Y(i), '.', 'color', C, 'MarkerSize', MarkerSize);
end
hold off

end

% [EOF] - PLOT_COLOR.M

Contact us