Scatter Plot and Conditional Colour Gradients.

15 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by