matlab如何删除图例中的一些选项,如何在MATLAB中删除特定的uicontextmenu选项(例如在图例菜单中)...

您需要做的第一件事是将

root object的

ShowHiddenHandles property设置为“on”,这将使隐藏的句柄可被发现.然后你可以做以下事情:

>> hMenu = get(lg, 'UIContextMenu') % Get the context menu handle

hMenu =

ContextMenu with properties:

Callback: ''

Children: [12×1 Menu] % This would be empty if handles were still hidden

Show all properties

>> hItems = get(hMenu, 'Children') % Get the menu item handles

hItems =

12×1 Menu array:

Menu (scribe:legend:mcode)

Menu (scribe:legend:propedit)

Menu (scribe:legend:orientation)

Menu (scribe:legend:location)

Menu (scribe:legend:interpreter)

Menu (scribe:legend:font)

Menu (scribe:legend:linewidth)

Menu (scribe:legend:edgecolor)

Menu (scribe:legend:color)

Menu (scribe:legend:edittitle)

Menu (scribe:legend:delete)

Menu (scribe:legend:refresh)

>> delete(hItems(4)); % Delete the fourth item

以上也可以使用点符号进行属性访问,如下所示:

delete(lg.UIContextMenu.Children(4));

此外,您可以隐藏手柄并使用findall,这需要您了解您正在寻找的对象的一些属性.例如,要查找并删除当前图中“Label”属性设置为“Location”的菜单对象,请执行以下操作:

delete(findall(gcf, 'Label', 'Location'));

对于上述所有情况,您可以确认“位置”选项现在已从上下文菜单中消失:

na83t.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值