How can i use transparency parametr in plot3 or other method to make my plot semi transparency

12 views (last 30 days)
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

Answers (1)

jonas
jonas on 28 Jun 2018
Edited: jonas on 28 Jun 2018
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
Read more here ( link ).
  11 Comments
jonas
jonas on 28 Jun 2018
Edited: jonas on 28 Jun 2018
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.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!