In Scatter plot, make the largest data on the top
Ältere Kommentare anzeigen
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 Kommentar
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.
Antworten (2)
Star Strider
am 15 Jan. 2022
0 Stimmen
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
am 15 Jan. 2022
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')
Kategorien
Mehr zu Annotations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
