5D Data with scatter3?

12 次查看(过去 30 天)
Daniel
Daniel 2021-9-27
编辑: Daniel 2021-9-27
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:
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
Steven Lord 2021-9-27
What is the size of each of the five variables you're passing into scatter3?
Daniel
Daniel 2021-9-27
All the data are created within the script, so I can make them whatever I want.

请先登录,再进行评论。

采纳的回答

Steven Lord
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.
  1 个评论
Daniel
Daniel 2021-9-27
编辑:Daniel 2021-9-27
Oof. I had this at one point, but I was plotting with a combination of number of points and marker size that made it look like a filled contour instead of individual points, so I thought it wasn't working!

请先登录,再进行评论。

更多回答(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