5D Data with scatter3?
조회 수: 8 (최근 30일)
이전 댓글 표시
It seems like you should be able to plot 5D data with scatter3 using the three coordinates, the marker size, and the color. I can't figure it out, though. Here's my equation:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/751154/image.png)
I had it working fine while fixing one variable and using meshgrid for the calculation and color to represent the LHS, but can't figure out how to include all five variables. Since meshgrid only goes up to three dimensions, I'm not sure that's a viable way. I thought there might be a simple "trick" by just repeating the calculation and using hold on with the plot, but I haven't gotten that to work either. I tried something akin to:
for variable1
for variable2
for variable3
for variable4
LHS = RHS
end
scatter3(variable1,variable2,variable3,variable4,LHS), hold on
end
end
end
This only returns a plot of data along a corner-to-corner diagonal. What's the right way to plot with all five variables?
댓글 수: 2
Steven Lord
2021년 9월 27일
What is the size of each of the five variables you're passing into scatter3?
채택된 답변
Steven Lord
2021년 9월 27일
It is possible to plot with five arrays:
[x, y, z] = peaks;
s = 10*(x.^2 + y.^2 + 1);
c = abs(z);
scatter3(x(:), y(:), z(:), s(:), c(:))
colorbar
Perhaps if you show us a sample of code we can execute and describe how the behavior of that code differs from how you want it to behave we may be able to offer more targeted suggestions for how to achive your goal.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!