Scatter Plot and Conditional Colour Gradients.

15 views (last 30 days)
f_tot = rand(50,9);
hold on
box on
for ph = 1:length(numhels)
for pr = 1: 1:Nrows(1)
if f_tot(ph,pr) >= 0.85000
c = 'red';
scatter(x(ph,pr),y(ph,pr),9,c,'filled');
hold on;
else
if f_tot(ph,pr) >= 0.7 && f_tot(ph,pr) <= 0.84999
c = 'yellow';
scatter(x(ph,pr),y(ph,pr),9,c,'filled');
hold on;
else
if f_tot(ph,pr) >= 0.6 && f_tot(ph,pr) <= 0.69999
c = 'green';
scatter(x(ph,pr),y(ph,pr),9,c,'filled');
hold on;
else
if f_tot(ph,pr) >= 0.4 && f_tot(ph,pr) <= 0.59999
c = 'cyan';
scatter(x(ph,pr),y(ph,pr),9,c,'filled');
hold on;
else
if f_tot(ph,pr) < 0.40
c = 'blue';
scatter(x(ph,pr),y(ph,pr),9,c,'filled');
hold on;
end
end
end
end
end
end
end
Hello,
Can the scatter plot be made to take in the colormap or jet function.Instead of the 'c'defining specific colors but rather have the entire points in the plot as a gradient.
Thanks

Accepted Answer

Walter Roberson
Walter Roberson on 31 Dec 2017
No loops:
scatter(x(:), y(:), 9, f_tot(:), 'filled');
colormap(jet)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!