Scatter Plot and Conditional Colour Gradients.

16 Ansichten (letzte 30 Tage)
Zaharaddeen Hussaini
Zaharaddeen Hussaini am 31 Dez. 2017
Beantwortet: Walter Roberson am 31 Dez. 2017
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

Akzeptierte Antwort

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

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by