3D scatterplot with marker color as a function of fourth variable

조회 수: 73 (최근 30일)
Toby Feld
Toby Feld 2021년 5월 7일
댓글: Toby Feld 2021년 5월 7일
Hello,
I would like to make a scatterplot with the variables x, y, and z. The color of the marker should be determined by the value of variable a.
What's the best way to do that?
Cheers,
Tim

채택된 답변

Scott MacKenzie
Scott MacKenzie 2021년 5월 7일
편집: Scott MacKenzie 2021년 5월 7일
Assuming you want a separate color for each point...
x = rand(1,100);
y = rand(1,100);
z = rand(1,100);
a = 1:100;
scatter3(x,y,z,50,a,'filled');
colorbar;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by