Displaying 3D data with adjusted transparency values in Matlab
조회 수: 9 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Shubham
2023년 9월 28일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!