Displaying 3D data with adjusted transparency values in Matlab

2 visualizaciones (últimos 30 días)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- el 29 de Ag. de 2022
Respondida: Shubham el 28 de Sept. de 2023
I have a 3D matrix of size 300x178x124 that I plot using the slice command:
diff = double(squeeze(glacier));
diff(diff==0)=nan;
h = slice(realx,realy,realz,diff, [], [], 1:size(diff,1));
set(h, 'EdgeColor','none', 'FaceColor','interp', 'FaceLighting','gouraud')
colormap(flipud(pink))
colorbar;
caxis([0 5])
shading interp
daspect([0.5 1 .2])
view(-149,32)
I was wondering if it is possible to
(a) add transparency based upon the value of the 3D matrix, e.g. value of 0 in "diff" is 100% transparency while the maximum value of "diff" is displayed using 0% transparency.
(b) is there a way to visually improve the 3D presentation? It seems to me that the data display is rather patchy and does not really look that nice.

Respuestas (1)

Shubham
Shubham el 28 de Sept. de 2023
I understand that you want to add transparency to the plot based on the values of diff. You can modify the alpha values of the surface using FaceAlpha property. Normalize the values in the diff matrix and use them in place of alpha values as the values should be between 0 and 1.
You can refer to the following:
For improving the 3D representation, you can adjust the colormap.  Instead of using the flipud(pink) colormap, you can experiment with different colormaps that better represent your data. MATLAB provides several built-in colormaps, or you can create your own custom colormap.
Hope this helps!!

Categorías

Más información sobre Blue 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!

Translated by