Filter löschen
Filter löschen

How to do 3d color gradient plot ?

34 Ansichten (letzte 30 Tage)
Teerapong Poltue
Teerapong Poltue am 6 Nov. 2020
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 ?

Akzeptierte Antwort

Anshika Chaurasia
Anshika Chaurasia am 9 Nov. 2020
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.

Weitere Antworten (0)

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by