In Scatter plot, make the largest data on the top
이전 댓글 표시
Dear Mathwork
I am using "scatter3" to obtain the 4D image with colorbar.
However, only very few data shows in the upper limit region and it will be covered by the other dots( red arrow)
Is there anyway to make sure these "larger" one alway on the top of the figure?
I try to manipulate the sequence of the raw data (matrix) but it did not work.
( The scale of the xlim, ylim or caxis need to be fix like this)

댓글 수: 1
If you're using scatter3() but you're only using view(2), can't you use the cdata vector to order the points on the depth axis of the plot?
Something like this
N = 1000;
x = rand(N,1);
y = randn(N,1);
c = rand(N,1);
h = scatter3(x,y,c,30,c);
h.MarkerFaceColor = 'flat';
colorbar
view(2)
Markers with higher values on the color scale are closer to the camera.
But if you're using scatter3() for something else, idk what that'd be. I don't know how your data is arranged.
답변 (2개)
Star Strider
2022년 1월 15일
0 개 추천
Since the data are being plotted with scatter3, experiment with the view function to rotate the 3D figure to display it as desired, since rotating the axes could do that.
Image Analyst
2022년 1월 15일
Maybe try sorting so that the higher value points are plotted last. Possibly (untested)
% Sort Z so that bigger values are at the bottom.
[zSorted, sortOrder] = sort(z, 'ascend');
% Sort x and y the same way so as to keep rows together.
xSorted = x(sortOrder);
ySorted = y(sortOrder);
cMap = turbo(length(x)); % Make colormap.
scatter3(xSorted, ySorted, zSorted, 30, cMap, 'filled')
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
