The transparency of patch in legend changes when the legend is updated in the plot browser in the figure. How can I stop it?
1 次查看(过去 30 天)
显示 更早的评论
Why does the patch transparency of a filled plot change when I update the legend in the plot browser?
I would like to plot my curves and then hide/delete some of them and then update the figure and legend using the features in the plot browser. Unfortunately,the patch transparency for my one curve changes if I refresh or delete and reinsert the legend. Also, I notice the text (latex) for the one curve doesn't come out properly unless I reinsert the legend directly in the plot browser. Why? ( I need some of the text in 'latex' and others in 'tex')
I also don't understand why I get this error 'Error using matlab.graphics.primitive.Data/set...There is no interpreter property on the Line class.'
Here's a sample of my code (note my actual script has a lot more line curves and a at least 2 filled curves). I am using Matlab 2016b.
Thanks
0 个评论
采纳的回答
Elizabeth Reese
2017-12-4
Any time the legend creates new patches, they will default to the non-transparent FaceAlpha. Using the syntax to return the LegIcon set is not recommended in the documentation as it does not support all graphics features and may not automatically update as you add or remove data series from the axes. To address this, MathWorks is working on an update to the legend so that the patches in the legend are the same FaceAlpha as their corresponding lines. This update is being considered for a future release of MATLAB.
As to the error you are seeing, that is because LegIcon includes the line, text, and patch objects that are children of the legend. The set command is trying to set the interpreter for each of these objects, but Line objects do not have this property. Try changing this set command to:
set(findobj(LegIcon,'type','text'),'interpreter', 'latex', 'fontsize', 8);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!