How can I change color of a straight line based on a numeric value ?

Hello Matlabers!! I need to plot n straight lines for which I will be getting data from a .csv file. The data will be x1, y1, x2, y2, ppm. where ppm is the a measure of something. I need to plot all lines in a single plot with the color of the lines based on ppm value.
Can you help me with this ?
I appreciate your time...
Thanks

Answers (1)

2 Comments

Thanks Walter.
But my question is a little bit different. Please have a look at my code.
LinkMat = xlsread('abc.xlsx','abc');
LinkMat(:,3) = log(LinkMat(:,3)+1);
hold on;
for i = 1:size(LinkMat,1)
% X Y
plot(LinkMat(i,1), LinkMat(i, 2));
grid on;
end
hold off;
I need to color these individual points based on a scale for example, if min value of intensity is 0 and max. value is 20 then a value of 1.1 will be light blue, 2.3 would be blue and so on.
I guess there is some ColorMapscale function that can be used. but I am not sure. Can you suggest something.
Thanks,
If you want to color individual points and not draw any connecting line, then use scatter() instead of plot()

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Asked:

on 4 Mar 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!