scatter3 color projection
5 次查看(过去 30 天)
显示 更早的评论
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/694584/image.jpeg)
0 个评论
采纳的回答
KSSV
2021-7-25
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!