Increasing transparency of plotted line, fading out
30 views (last 30 days)
Show older comments
Dear all,
I would like a plotted line to change from black to invisible (gradually from x = 1 to x = end). I do know how to change the alpha or color of a line, but not how it can be done gradually. Help is appreciated,
Kind regards,
stijn
Answers (1)
Vikram Mohan
on 9 Nov 2017
Hi Stijn,
For your workflow, one suggestion would be to use a patch object to plot the line. By doing so, one can set the "FaceVertextAlphaData" property of a patch object that would control transparency for an array of faces or vertices. For your case , you must specify the "FaceVertexAlphaData" property as a vector containing one transparency value per vertex gradually going from 1 (Opaque) to 0 (invisible). Caution: The length of the transparency data vector should match x.
The below link would give you more information of setting the "FaceVertexAlphaData" for a patch object that would create a line with interpolated transparency.
https://www.mathworks.com/help/matlab/visualize/add-transparency-to-graphics-objects.html?s_tid=answers_rc2-2_p5_MLT
1 Comment
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!