Plotting a 3D scalar field as a coloured 3D scatter graph
31 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a 3D temperature data set: a 3D array giving the temperature at each point in a 3D cartesian space, with coordinates x, y, z. I would like to find a way of visualising this data set. I thought it would be straightforward to plot a 3D scatter graph, and at each point on the graph the temperature is represented by a colour. However, I'm not sure how to use the scatter3 function.
Can anyone please help me to plot this data?
Specifically my data is:
x=linspace(-0.3,0.3,16); y=linspace(-0.3,0.3,16); z=linspace(-0.3,0.3,16);
Then I have a 3D array, Temperature(x,y,z) which has a different value for each set x,y,z.
Thanks.
0 个评论
采纳的回答
Patrick Kalita
2012-5-2
编辑:John Kelly
2014-5-27
If you want to use scatter3, you can pass it your x, y, and z vectors which will define where markers will be drawn. Then your temperature data can be used to control the size and/or color of the markers. According to your description, x, y, and z are vectors whereas Temperature is a 3D array. That seems slightly odd, but I suppose plausible. At any rate, you'd need to at least convert that 3D array into a vector before passing it to scatter3:
scatter3( x, y, z, [], Temperature(:) ); % Use Temperature to set marker color
That makes some assumptions about how the data is actually stored, but it's a best guess based on the information you've given.
If you have a lot of data points, then scatter3 isn't the best option.
2 个评论
wendy wang
2015-2-4
编辑:wendy wang
2015-2-4
Hi Paul, I took the suggestion to visualize my data with scatter3. I have (x, y, z, P) data set, where x, y ,z are coordiantes with size of 1*N. P is the parameter at the corresponding location and it also has the size of 1*N. I can successfully visualize my data using scatter3, but can not do the slice plot. How do you do the slice plot for such case with scatter data? It looks like the slice function only apply to 3-D array of x, y,z and P. Can I do it in a 1-D array?
By the way, I have a lot of data points, besides the scatter3, is there any other better idea to visualize the data in 3D space with color indicating the P parameter? Thanks for any advice!!
Wendy
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!