Effacer les filtres
Effacer les filtres

scatter3 color projection

3 vues (au cours des 30 derniers jours)
Tsuwei Tan
Tsuwei Tan le 25 Juil 2021
Commenté : Tsuwei Tan le 25 Juil 2021
Please load the test_data.mat
load('test_data.mat','test')
x=test(:,1);
y=test(:,2);
z=test(:,3);
scatter3(x,y,z)
This gives me a 3D scatter plot, but how do I create a probability density function which looks like the pic below? The colorbar is normalized for z values and the min of z is shown as red, max is shown as blue. Thank you!

Réponse acceptée

KSSV
KSSV le 25 Juil 2021
clc; clear all ;
load('test_data.mat')
x=test(:,1);
y=test(:,2);
z=test(:,3);
figure
scatter(x,y,1000,z,'s','filled');
xi = linspace(min(x),max(x)) ;
yi = linspace(min(y),max(y)) ;
[X,Y] = meshgrid(xi,yi) ;
Z = griddata(x,y,z,X,Y) ;
figure
pcolor(X,Y,Z) ;shading interp ; colorbar
  1 commentaire
Tsuwei Tan
Tsuwei Tan le 25 Juil 2021
Thank you for your quick and correct answer, this really helps!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by