MATLAB Answers

What happened to the figure toolbar in R2018b? Why is it an axes toolbar? How can I put the buttons back?

1,027 views (last 30 days)
In R2018b, tools such as the zoom, pan, datatip, etc are no longer at the toolbar at the top of the figure window. These buttons are now in an "axes" toolbar and only appear when you hover your mouse over the plot. How do I put the buttons back at the top of the figure window?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Aug 2019
Edited: MathWorks Support Team on 16 Aug 2019
In the R2018b release, you can drag-to-pan and scroll-to-zoom in an axes without having to call any MATLAB functions or select any toolbar buttons. Most types of axes include a default set of built-in interactions, but you can customize them by setting the Interactions property of the axes. For more information about controlling chart interactivity, see the following link:
You can also return the tools to the figure toolbar using the "addToolbarExplorationButtons" function. See the below example:
addToolbarExplorationButtons(gcf) % Adds buttons to figure toolbar
You can also hide or remove the axes toolbar with the code below:
ax = gca;
ax.Toolbar.Visible = 'off'; % Turns off the axes toolbar
ax.Toolbar = []; % Removes axes toolbar data
If you would like to ensure that figures always open with the tools in the toolbar and that axes never contain a toolbar, execute the following code:
The above settings will be reset when MATLAB re-starts. To ensure that these settings are used even after MATLAB re-starts, place the above "set" commands in a startup.m file. The startup.m file, when placed on the MATLAB Path, is run during the program start-up process. For more information about startup.m files, see the following link:
UPDATE (8/15/19):
Thank you for all of your comments and proposals about the axes toolbar.
We have heard your feedback and worked with members of the community on ways to improve the axes toolbar experience. With R2019a we released several enhancements to the axes toolbar, including faster startup time, ability to hover directly over the toolbar to make it visible, and improved performance with dense surface data. Additionally, with R2018b Update 5 we have made performance improvements to the axes toolbar startup time. We will continue to develop enhancements to the axes toolbar experience, and would like to thank you again for your feedback to help us improve our products.
You can download the latest updates using the following link:


Robert White
Robert White on 5 Jun 2019
Please put the zoom tools back in the toolbar by default. Like everyone else on this forum, I used them all the time and I can't believe you hid them.
John on 30 Oct 2019
I’m glad to see that MathWorks is working on improvements to resolve this. I have two suggestions for improvement. The two main problems with the new toolbar are 1) it takes longer to explore figures and 2) it’s not obvious which mode you are in.
1) If I select a line and then I want to use the box zoom I have to: click on the edit arrow to de-select it, move my cursor to the other side of the figure, wait for the hover, and then click the zoom icon. This used to be a single click on the zoom icon. This problem could be easily resolved by making the toolbar visible during edit mode (hover does not work in edit mode) so that the user could click directly on the zoom icon. Also, allowing some navigation during edit mode would be nice.
2) The user cannot quickly tell if they are in edit or navigation mode (sure you can look at the icon on the toolbar and see if it’s selected, but that’s annoying). The cursor is a white arrow when I’m in navigation mode (in this mode I can roll the mouse wheel to zoom), but when I’m in edit mode I see the same white cursor arrow (in this mode rolling the mouse wheel does nothing). Previously, every action had a different cursor icon (e.g. +, -, etc.) so you knew which mode you were in, and therefore how the mouse would respond. I would suggest making a separate icon for navigation, so the user can readily see which mode they’re in.

Sign in to comment.

More Answers (5)

Yair Altman
Yair Altman on 10 Jan 2019
Edited: Yair Altman on 10 Jan 2019
For the benefit of readers who don't follow my blog, Michelle Hirsch posted the following comment yesterday, which sheds some light on the subject:
Rest assured the team is digging in to the feedback to figure out the best approach to addressing concerns.
One thing puzzles me about the whole conversation (esp. on MTLAB Answers). Nobody is mentioning the default axes interactions, which we introduced along with the axes toolbar. We actually felt this was the biggest breakthrough, because you don’t need to interact with the toolbar at all in order to zoom, pan, rotate, or add datatips to a chart. Any thoughts on this? There’s a huge banner on the figure in 18b that introduces these new gestures so we thought people would find them.
I also can clarify a couple of things from your post:
* The Toolstrip was not driven by the marketing guys (and gals!). It was very much driven by our interest in improving discoverability of key capabilities which were too buried in menus and toolbars.
* The axes toolbar was not created primarily to support the move to web graphics. We intended it to be a solution to multiple problems:
** The toolbar for a figure docked in the desktop can be very far from the figure itself.
** We’d like to move towards being able to define interactions at the axes level, instead of the figure level, since interactions are axes specific. The axes toolbar is one step in that direction


Show 3 older comments
David Goodmanson
David Goodmanson on 11 Jan 2019
Hello Yair,
Could you explain where the "huge banner on the figure in 18b is?" Is the banner perhaps something that appears the first time that Matlab is invoked after download, and then not again? Maybe no one is talking about the new features because they are effectively hidden.
At any rate, documentation by banner is not what most people would call good software practice.
And in this case the regular documentation of the phantom toolbar does not work either, for a different reason: it's inaccurate. If you go to "Interactively Explore Plotted Data" it says: "Some types of interactions are enabled by default, while other types of interactions are only available through the axes toolbar. The toolbar appears at the top-right corner of the axes when you hover over it."
This is not true. It only appears when you hover the cursor over the actual plot. Then, as i mentioned in a separate comment, if you take the cursor off the plot (still in the figure window but not on the toolbar) the toolbar disappears again, intentionally taking away any visual knowledge of whether any of the toolbar zoom states are active or not. That's poor.
Alaster Meehan
Alaster Meehan on 6 Mar 2019
I am yet to upgrade to 2018b but for my UI I'm hoping this will be a huge benefit. I have a complicated UI with multiple axis and controls. I wasted a lot of time trying to find work arounds to have different controls working on different images such as zoom. I'm hoping this change fixes this.
I feel that the change to controls being on the axis instead of the figure is long over due, not sure why there is such a big backlash.
wea555 on 14 May 2019
Even in my complex GUI, with subplots, I don't want axis-specific controls. Just one button Zoom+ and I can zoom into all measurement channels. If I had to switch it on several times, this would be very annoying.
If someone wants axis-specific controls, make it an option to switch it on. But leave the old behaviour, because it is the most reasonable. Almost nobody likes the new one. Just leave it like it was before as default.
The fading-effekt is also very annoying. If somebody likes it, why not make it optional?

Sign in to comment.

Michael Montouchet
Michael Montouchet on 25 Jun 2019
I am using a scatter3. It used to be very easy to rotate the things I display, now I have to use this command before being able to use the camera rotation:
It used to be simple.
Why is Matlab deleting nice features?
The reasons why Matlab is better than Python are the UI, the support, good documentation, user-friendlyness. Please continue this way and stop deleting what makes it easy. Otherwise, I would not see the point of using Matlab instead of Python.


Sign in to comment.

Scott Nuccio
Scott Nuccio on 26 Jun 2019
Edited: Scott Nuccio on 26 Jun 2019
Here is the best I have come up with. Thought I would share.
In my startup.m file I have the following line. They overwrite the new figure functions such that everytime you create a figure, the axes toolbar is removed and my script for adding the appropriate buttons to the figures toolbar is called.
try %#ok
if ~verLessThan('matlab','9.5')
My script for adding buttons to the toolbar is called 'figToolbarFix.m' and lives in my 'user -> documents -> matlab' folder with my 'startup.m' file.
function [] = figToolbarFix(hFig)
%UNTITLED2 Summary of this function goes here
% Customize the default figure toolbar
% hFig = handle of figure to be customized
% Example: figToolbarFix(gcf);
% Example: hFig=figure; figToolbarFix(hFig);
% enable the old 'zoom', 'rotation', 'pan', 'data tips', etc., buttons
% load a pretty images to use for our buttons. Check MATLAB\release\toolbox\matlab\icons for other options, or
% make your own. Note the double conversion (rgb -> ind -> rgb) to normalize a png image.
[img1,map1] = rgb2ind(imread(fullfile(matlabroot,...
[img2,map2] = imread(fullfile(matlabroot,...
% Convert image from indexed to truecolor (want true color RGB with values of 0 to 1)
icon1 = ind2rgb(img1,map1);
icon2 = ind2rgb(img2,map2);
% Get hiddenhandle of the toolbar we want to append to. By default the 'Figure Toolbar' is the only one active
% and should be listed last assuming a new, blank figure. Use 'figure; allchild(gcf)' to show all children
hToolbar=findall(gcf, 'type', 'uitoolbar'); %hToolbar=allchild(hFig); hToolbar=hToolbar(end);
%% for Seperate property editor and plot browser buttons
% % Add a new uipushtool to the end of the toolbar.
% uipushtool(hToolbar,'CData',icon1,...
% 'TooltipString','Property Editor',...
% 'ClickedCallback','propertyeditor',...
% 'Separator','on',...
% 'HandleVisibility','off');
% % Add a new uipushtool to the end of the toolbar.
% uipushtool(hToolbar,'CData',icon2,...
% 'TooltipString','Plot Browser',...
% 'ClickedCallback','plotbrowser',...
% 'Separator','off',...
% 'HandleVisibility','off');
%% for a single toggle that opens/closes the previous state of the plot tools (use view menu to show/hide plot/browser/editor)
'TooltipString','Property Editor',...
Take and go forth!!
Also see for more info and customizations:
Good Luck


Rik on 26 Jun 2019
You could also consider these edits:
%in startup.m:
try %#ok
if ~verLessThan('matlab','9.5')
% Using evalc ensures that you can group functions in a single
% anonymous function that otherwise have no output (as neither
% disableDefaultInteractivity() nor set() have output arguments).
set(groot,'defaultFigureCreateFcn', ...
set(groot,'defaultAxesCreateFcn', ...
%for use in functions you might need to share with others:
function fig=figure_legacy(varargin)
try %#ok if verLessThan is missing verLessThan would have returned true
if ~verLessThan('matlab','9.5')
% Use eval to trick the syntax checking in ML6.5 (both the ~ and
% the @ trip up the syntax checker).
% Using evalc ensures that you can group functions in a single
% anonymous function that otherwise have no output (as neither
% disableDefaultInteractivity() nor set() have output arguments).
set(fig,'defaultAxesCreateFcn', ...
Matt J
Matt J on 12 Sep 2019
A test of whether hToolbar is empty or not seems to be needed. I get frequent errors otherwise,
if ~isempty(hToolbar)
'TooltipString','Property Editor',...

Sign in to comment.

Bruno Luong
Bruno Luong on 14 Sep 2019
Duplicate my poste here
For R2019b all the tricks found previously no longer work.
I found this one does the trick
set(groot,'defaultAxesCreateFcn', ...
@(ax,varargin) start(timer('StartDelay',1,'ExecutionMode','singleShot','TimerFcn',@(varargin) axtoolbar(ax,{}))));
You might put it in startup.m file
if ~verLessThan('MATLAB','9.7')
set(groot,'defaultAxesCreateFcn', ...
@(ax,varargin) start(timer('StartDelay',1,'ExecutionMode','singleShot','TimerFcn',@(varargin) axtoolbar(ax,{}))));

  1 Comment

thosman on 28 Sep 2019
Here are two additional ways to remove the toolbar in 2019b without timers. As mentioned elsewhere, place code for either method in your startup.m.
Method 1)
From playing around with removing the toolbar, I found that AxesCreateFcn method is no longer working as the cla(ax,'reset') is called after the axes is created (when hold is 'off' or the axes NextPlot property is "replace", which is the default). This resets the axes properties to their defaults (which appears to include the toolbar).
This method requires the axes to have hold on behavior by default, which bypasses the offending cla code path.
function SetDefaultFigureToolbar()
% Returns to pre-2018 style figures for all figures
% Note! This forces all axes to have hold 'on' by default
% Adds the toolbar back to the figure
% Removes the axes toolbar and interactions
% Set axes to be in hold 'on' mode by default
try %#ok
if ~verLessThan('matlab','9.5') % if matlab version >= 2018b
set(groot,'defaultAxesCreateFcn', @axDefaultCreateFcn);
set(groot, 'defaultAxesNextPlot', 'add'); % default hold 'on' behavior
function axDefaultCreateFcn(hAxes, ~)
% On axes creation, remove the toolbar and interactions.
% From:
hAxes.Interactions = [];
hAxes.Toolbar = [];
% ignore - old Matlab release
Method 2)
Removes the toolbar by making its default visible propery false. This method cannot remove interactions which have been shown to improve performance, but method 1 or the timer method by Bruno would allow for interaction update/removal.
set(groot, 'defaultAxesToolbarVisible', 'off')
Changes in default behavior
Finally, it is worth re-iterating that Method 1 changes default behavior by having hold on by default. Method 2 does not allow for adjustments to default interactions. Bruno's timer method should be able to accommodate both of these without changing matlab's default behavior.

Sign in to comment.

Tomoya Takeuchi
Tomoya Takeuchi on 4 Jan 2019
I put this lines in my startup.m


John Wood
John Wood on 4 Jan 2019
Thank you Tomoya! This works great.
I like this disastrous feature: one click compared with hunting around the menus for a disastrous feature I use all the time to inspect my results. It's quick and easy and does the same thing every time.

Sign in to comment.

Sign in to answer this question.


No tags entered yet.



No release entered yet.