Displaying 3D data with adjusted transparency values in Matlab
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (1)
Shubham
am 28 Sep. 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!!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!