Is it possible to colour a scatter3 according to its mean and maximum value

1 vue (au cours des 30 derniers jours)
ANKITA MAITY
ANKITA MAITY le 26 Sep 2021
Réponse apportée : Dave B le 27 Sep 2021
i have velocities distributed in a 3d scatter plot along a cosine hill prrofile . i want to view where the velocity is increasing and where it is decresing its value.

Réponses (1)

Dave B
Dave B le 27 Sep 2021
You can color the points in a scatter3 by passing in a vector specifying the value you'd like to map onto color as the 5th argument to scatter3
[xi,yi]=meshgrid(1:30,1:30);
zi=gausswin(30)*gausswin(30)';
[fx,fy]=gradient(zi);
nexttile
ci=zi;
scatter3(xi(:),yi(:),zi(:),10,ci(:),'filled')
colorbar
nexttile
ci=fx;
scatter3(xi(:),yi(:),zi(:),10,ci(:),'filled')
colorbar
nexttile
ci=fy;
scatter3(xi(:),yi(:),zi(:),10,ci(:),'filled')
colorbar
nexttile
ci=sqrt(fx.^2+fy.^2);
scatter3(xi(:),yi(:),zi(:),10,ci(:),'filled')
colorbar
colormap turbo

Catégories

En savoir plus sur Colormaps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by