How can i use transparency parametr in plot3 or other method to make my plot semi transparency
이전 댓글 표시
I want to make my plot3 semi transparency
l1=20;l2=50;l3=40;
t1=linspace(-180,180,45)*pi/180;
t2=linspace(-180,180,45)*pi/180;
t3=linspace(-180,180,45)*pi/180;
[T1,T2,T3]=ndgrid(t1,t2,t3);
xM = round(l2*cos(T1).*cos(T2)+l3*cos(T1).*cos(T2+T3));
yM = round(l2*sin(T1).*cos(T2)+l3*sin(T1).*cos(T2+T3));
zM = round(l1+l2*sin(T2)+l3*sin(T2+T3));
w=plot3(xM(:),yM(:),zM(:),'b.','LineWidth',0.3)
i have try
w.color(4)=0.5
and changing Alpha paremetr but it didnt work
Thanks for your help
답변 (1개)
You can play around with some hidden marker properties.
%get marker handles
markers=w.MarkerHandle;
%change transparency by altering 4th element
markers.EdgeColorData=uint8([0 0 255 50])'
edit: You have to add drawnow before those two lines of code
댓글 수: 11
Maciej Zareba
2018년 6월 28일
jonas
2018년 6월 28일
What do you mean not working? Is the attached result not what you are looking for?
Maciej Zareba
2018년 6월 28일
편집: Maciej Zareba
2018년 6월 28일
Maciej Zareba
2018년 6월 28일
jonas
2018년 6월 28일
Dont know. Maybe someome smarter than me can chime in.
Maciej Zareba
2018년 6월 28일
jonas
2018년 6월 28일
No problem. Maybe these will help you
https://se.mathworks.com/matlabcentral/answers/249044-code-fails-to-run-in-function-works-in-command-window-works-in-debug-evaluate-selection
https://se.mathworks.com/matlabcentral/answers/90391-the-command-is-working-perfectly-in-the-command-window-but-not-as-a-script
Maciej Zareba
2018년 6월 28일
btw, I have updated the answer to fix the previous issue with command not working in script.
I don't have a fix for your most recent issue. If you want to pan/rotate, the transparancy is reset and you must manually update it. If you want to print a specific view, just change the view() in the script before changing the transparency.
Maciej Zareba
2018년 6월 29일
카테고리
도움말 센터 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!