Scatter3 plot with patch properties
Afficher commentaires plus anciens
I have a logical N x N x N logical array isAct and I want a scatter plot of the 1's. The obvious choice is using find
[ii, jj, kk] = find(isAct);
and then
scatter3(ii,jj,kk)
However I want to apply some of the patch properties (lighting etc.).
[xx, yy, zz] = meshgrid(1:N,1:N,1:N);
value = 0.5;
hpiso = patch(isosurface(xx,yy,zz,double(isAct),value));
isonormals(xx,yy,zz,double(isAct),hpiso)
view(3)
I would expect this to work for value = 1, but it shows nothing (so I misunderstood something). For other values it works, but the objects it plots are not the 1's (they do not coincide with the result of scatter3).
Where am I wrong?
Réponses (1)
Walter Roberson
le 29 Juil 2016
That form of find() does not return x y z coordinates. That form of find returns row and column coordinates and value at the location. You should be using something like
pos = find(isAct);
[ii, jj, kk] = ind2sub(size(isAct),pos);
scatter3(ii,jj,kk)
Catégories
En savoir plus sur Polygons 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!