필터 지우기
필터 지우기

scatter3 color projection

조회 수: 3 (최근 30일)
Tsuwei Tan
Tsuwei Tan 2021년 7월 25일
댓글: Tsuwei Tan 2021년 7월 25일
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!

채택된 답변

KSSV
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
  댓글 수: 1
Tsuwei Tan
Tsuwei Tan 2021년 7월 25일
Thank you for your quick and correct answer, this really helps!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by