enableLegacyExplorationModes - Control behavior of modes in figures - MATLAB (original) (raw)
Control behavior of modes in figures
Syntax
Description
enableLegacyExplorationModes([fig](#mw%5Fb47ec125-9dc6-44d7-abbf-3d391f4373dd))
changes the behavior of interaction modes in figures. The behavior changes from the default behavior, in which you can control interaction behavior on a per axis basis, to legacy exploration modes. For more information, see Legacy Exploration Modes. (since R2025a)
In most cases, you do not need to use this function. By default, most types of charts include a set of built-in interactions that are faster than interaction modes and do not require you to enable a mode. However, if you have code that relies on legacy exploration modes, then you can use enableLegacyExplorationModes
to change the behavior. For more information about built-in interactions, see Control Chart Interactivity.
Note
Once you change the behavior of a figure to legacy exploration modes, you cannot change the behavior back to the default behavior.
Before R2025a: enableLegacyExplorationModes(fig)
changes the behavior of interaction modes in UI figures created using the uifigure
function or inMATLAB® Online™. The behavior changes to match the behavior of modes in traditional figures created using the figure
function.
Before R2025a: Interaction modes such as pan, zoom, rotate, and brush behave differently for traditional figures and UI figures. For example, enabling zoom in a UI figure affects only the specified axes, while enabling zoom in a traditional figure affects all of the axes in the figure. Additionally, context menus are not supported for modes in UI figures, but are supported for modes in traditional figures.
Examples
Create a figure and display two charts in a tiled chart layout.
f = figure; t = tiledlayout(f,2,1);
ax1 = nexttile(t); x = rand(20,1); y = rand(20,1); scatter(ax1,x,y)
ax2 = nexttile(t); u = [75 91 105 123.5 131 150 179 203 226 249 281.5]; bar(ax2,u)
Enable brushing for the first set of axes. Note that brushing is enabled for only the specified axes.
Call enableLegacyExplorationModes
. Note that brushing is now disabled for both axes.
enableLegacyExplorationModes(f)
Again, enable brushing for the first set of axes. Note that brushing is now enabled for both axes.
Input Arguments
Target figure, specified as a Figure
object.
Limitations
- The
enableLegacyExplorationModes
function might cause interactions to respond more slowly. - If you enable legacy exploration modes on a figure, then you can no longer control the interactions on individual axes in the figure using the
InteractionOptions
property of the axes. If you specify values for theInteractionOptions
property of an axes object inside a figure that has legacy exploration modes enabled, then MATLAB issues a warning that no action has been taken.
More About
The interaction behavior in figures created in R2024b and earlier versions of MATLAB is called legacy exploration modes. In legacy exploration modes, you can control interaction behavior only on a per figure basis. So, in legacy exploration modes, all the axes inside a given figure always have the same interaction modes.
Algorithms
- The
enableLegacyExplorationModes
function sets theUseLegacyExplorationModes
property of pan, zoom, rotate3d, and brush mode objects to"on"
. - If you create an interaction mode object for a figure and then either specify a value for a property of that object or call one of the object functions of that object, then MATLAB enables legacy exploration modes on the figure. For example, this code enables legacy exploration modes on the figure because it specifies a value for theMotion property of the pan mode object.
f = figure;
ax = axes(f);
plot(ax,1:10,1:10);
p = pan(f);
p.Motion = "vertical"
Note
An exception to this rule is the UpdateFcn property of the datacursormode object. Setting this property does not enable legacy exploration modes.
Version History
Introduced in R2020a