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!