Borrar filtros
Borrar filtros

How to do 3d color gradient plot ?

34 visualizaciones (últimos 30 días)
Teerapong Poltue
Teerapong Poltue el 6 de Nov. de 2020
Respondida: Anshika Chaurasia el 9 de Nov. de 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 ?

Respuesta aceptada

Anshika Chaurasia
Anshika Chaurasia el 9 de Nov. de 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.

Más respuestas (0)

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