Effacer les filtres
Effacer les filtres

Syntax 3-D Scatter Plot Color as a Function of Altitude

10 vues (au cours des 30 derniers jours)
Ian Wood
Ian Wood le 9 Mai 2011
Commenté : Ebrahim Hesami le 10 Fév 2021
Hi all,
I have been working on a program that plots a 3-D image using coordinates specified in a text file. I need to know how to apply colors to the scatter3 plot as a function of altitude. I have tried:
colormap(option)... colormap option... set(gca,'ColorOrder',option)...
and here is my syntax:
scatter3(x1,y1,z1,'filled'); title('Motor Cylinder'); colormap(jet); colorbar;
xlabel('length'); ylabel('width'); zlabel('height');
Can anybody tell me what I am doing wrong, and how I can fix it?
Thanks, Ian

Réponse acceptée

Walter Roberson
Walter Roberson le 9 Mai 2011
dotsize = 6; %adjust as needed
scatter3(x1(:), y1(:), z1(:), dotsize, z1(:), 'filled');
  3 commentaires
Bruno Aravena Pérez
Bruno Aravena Pérez le 23 Déc 2020
Exactly what I was looking for, I am grateful.
Ebrahim Hesami
Ebrahim Hesami le 10 Fév 2021
Thanks for the solusion! i have applied for the 2D scatter with X and Y for the location of each point and used the hight of each point to make color map. works very well!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Colormaps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by