Main Content

enableLegacyExplorationModes

Control behavior of modes in figures

Description

enableLegacyExplorationModes(fig) 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 in MATLAB® 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.

example

Examples

collapse all

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.

brush(ax1,"on")

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.

brush(ax1,"on")

Input Arguments

collapse all

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 the InteractionOptions 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

collapse all

Algorithms

  • The enableLegacyExplorationModes function sets the UseLegacyExplorationModes 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 the Motion 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