How to rotate the symblo only in the 3D map
Afficher commentaires plus anciens
I want to rotate the symbol(the marker) inside the figure, how to make the marker parrallel to X-Y surface as shown in fig.2?
thanks very much in advance
Réponse acceptée
Plus de réponses (1)
ChristianW
le 8 Fév 2013
Modifié(e) : ChristianW
le 8 Fév 2013
Here is a simple basic part.
n = 100;
X = randi(n,30,1); Y = randi(n,30,1); Z = randi(n,30,1);
r = 4; % factor for radius scale
uZ = unique(Z);
cmap = jet(length(uZ));
for i = 1:length(Z)
R = r * (mean(Z)/300 + (Z(i)-min(Z))/range(Z));
[x,y] = pol2cart(0:pi/8:2*pi,R);
z = zeros(length(x));
C = cmap(uZ==Z(i),:);
patch(x+X(i),y+Y(i),z+Z(i),C,'EdgeColor','none')
end
axis tight; box on; view(23,60)
Scaling the patches for all possible inputs isnt done here. Some manual scaling can be done with r.
3 commentaires
Walter Roberson
le 8 Fév 2013
True. There really isn't a lot of point in going the route of scatter3() followed by changing all the patches that scatter3() creates: might as well just do what you did here, create the patches directly.
The bit with sort() is inefficient though. You might as well use the multi-output version of unique() once before the loop.
Also, should cmap be created as length(Z) or only length() of the unique Z?
ChristianW
le 8 Fév 2013
Both true, changed/edited the code, thanks.
Catégories
En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!