How to enable rotation context menu when anywhere in the uiaxes plot area is right clicked?

3 views (last 30 days)
I am currently working in App Designer and plotting data with scatter3 which can leave a lot of the plot area empty. When I enable the rotation toolbar and right click over data, the rotation context menu pops up (Restore View, Go to X-Y view...) but when I am not over data and right click that menu does not show up. I get the following warnings:
Warning: Setting the "ContextMenu" property is not permitted while this mode is active.
> In matlab.graphics.interaction.internal/WebAxesModeWarnings/localModeWarn
In matlab.graphics.interaction.internal.WebAxesModeWarnings
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
Warning: Setting the "ContextMenu" property is not permitted while this mode is active.
> In matlab.graphics.interaction.internal/WebAxesModeWarnings/localModeWarn
In matlab.graphics.interaction.internal.WebAxesModeWarnings
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
Warning: Setting the "UIContextMenu" property is not permitted while this mode is active.
> In matlab.graphics.interaction.internal/WebAxesModeWarnings/localModeWarn
In matlab.graphics.interaction.internal.WebAxesModeWarnings
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
Warning: Setting the "ContextMenu" property is not permitted while this mode is active.
> In matlab.graphics.interaction.internal/WebAxesModeWarnings/localModeWarn
In matlab.graphics.interaction.internal.WebAxesModeWarnings
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter
In matlab.graphics.interaction.webmodes.figureModeInteractionOnEnter>@(o,e)restoreAllButtonCallback(hObj,interactionData.PropertyRestoreMap,hFig)
I have tried using a post set listener on the rotation toolbar so that it sets the UIAxes context menu to a duplicate rotation context menu I created. This worked to set the context menu but when the rotation toolbar option was disabled, the UIAxes context menu could not be reset.

Answers (1)

Rasmita
Rasmita on 8 Aug 2023
Hi,
It is my understanding that you want to enable rotation context menu when right clicked on the blank space of plot area, but you are getting above mentioned warnings while doing that.
There is no current workaround in MATLAB R2023a. This issue has been resolved in the prerelease for MATLAB R2023b.
In MATLAB R2023a, the warning message caused by this issue can be suppressed by executing the following command:
>>warning('off','MATLAB:modes:mode:InvalidPropertySet')
Regards,
Rasmita

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!