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

1 visualización (últimos 30 días)
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.

Respuestas (1)

Dave B
Dave B el 27 de Sept. de 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

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by