How to do 3d color gradient plot ?

34 次查看(过去 30 天)
I've a set of data (x,y,z,k) which x y z is the coordinate in 3D plane, and k is the value of that position.
I would like to plot 3D with gradient color of that coordinate (x,y,z) have the value of k ,
if k is high value give them red color if k is low give them blue color.
How can I do that ?

采纳的回答

Anshika Chaurasia
Anshika Chaurasia 2020-11-9
Hi Teerapong,
It is my understanding that you want to plot 3D coordinates (x,y,z) having color as per the value of k.
For this use scatter3 function. (Refer to documentation provided as hyperlink for more information.)
c = k; % color of circles
scatter3(x,y,z,s,c = k) % s is size of circles and x, y, z are the coordinates
Here c can be a vector or three-column matrix of RGB triplets.
If k is a vector of length equal to x, y, z then the values of c (or k) are linearly mapped to the colors in the current colormap.

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by