How to do 3d color gradient plot ?

47 ビュー (過去 30 日間)
Teerapong Poltue
Teerapong Poltue 2020 年 11 月 6 日
回答済み: Anshika Chaurasia 2020 年 11 月 9 日
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 Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by