I am using isosurface to plot 3d density maps. I would like to plot multiple maps in the same figure, each one with a different color. How can I do so?
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Guy Nir
el 15 de Nov. de 2019
Comentada: Guy Nir
el 15 de Nov. de 2019
nBins=20;
D=cell(size(A,1),size(A,2));
for i=1:size(A,1)
for j=1:size(A,2)
if ~isempty(A{i,j})
x=A{i,j}(:,1); y=A{i,j}(:,2); z=A{i,j}(:,3);
xBins=linspace(min(x),max(x),nBins);
yBins=linspace(min(y),max(y),nBins);
zBins=linspace(min(z),max(z),nBins);
D{i,j}=zeros(nBins,nBins,nBins);
for ii=1:numel(x)
xi=find((x(ii)>xBins),1,'Last');
yi=find((y(ii)>yBins),1,'Last');
zi=find((z(ii)>zBins),1,'Last');
D{i,j}(xi,yi,zi)=D{i,j}(xi,yi,zi)+1;
end % for ii=1:numel(x)
D{i,j}=smooth3(D{i,j});
%isosurface(D{i,j})
%hold on
end % if ~isempty(A{i,j})
end % for j=1:size(A,2)
end % for i=1:size(A,1)
0 comentarios
Respuesta aceptada
Mil Shastri
el 15 de Nov. de 2019
You can try this:
[x,y,z,v] = flow;
figure;
p = patch(isosurface(x,y,z,v,-3));
p.FaceColor = 'yellow';
hold on;
p = patch(isosurface(x*3,y*1,z*3,v,-3));
p.FaceColor = 'red';
p.EdgeColor = 'none';
p = patch(isosurface(x*1,y*3,z*3,v,-3));
p.FaceColor = 'green';
p.EdgeColor = 'none';
hold off;
%optional
camlight
lighting gouraud
See isosurface documentation: https://www.mathworks.com/help/matlab/ref/isosurface.html
Más respuestas (3)
Mil Shastri
el 15 de Nov. de 2019
Hi Guy, Please provide a sample for A matrix too. The code doesn't run without it.
0 comentarios
Ver también
Categorías
Más información sobre Volume Visualization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!