Invisible graphics objects are selectable
4 次查看(过去 30 天)
显示 更早的评论
I have a plot with a legend so large it covers up some of the data. I thought it would be a good idea to add a keyboard function to hide the legend, so the user can temporarily hide the legend and interrogate the data (e.g. using the Data Cursor).
However, setting the legend "Visible" property to "off" still allows it to be selected. You can't click on plot lines because the invisible legend is covering them up.
Example:
figure();
plot(1:20,1:20);
L=legend({'blah'});
L.Position = [.05 .05 .9 .9];
L.Visible='off';
%Now try using the Data Cursor to select some data
Surely this can't be the intended behavior? I looked through the documentation for legend properties but could not find any anything that suggested this behavior could be changed.
I have some ideas for a work-around for the current application (When setting Visible='off', copy the Position property to UserData and set the Position to [-1 -1 0 0]. When setting Visible='on', set Position back to the original value).
However, this seems pretty basic so I don't want to waste time on a work-around. Am I missing something?
0 个评论
采纳的回答
更多回答(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!