MATLAB Answers


How can I remove the toolbar from the axes, but keep it at the top of the window?

Asked by Ajanae Williams on 23 Jul 2019
Latest activity Commented on by Rik
on 29 Jul 2019
How would I go about removing the toolbar that pops up when you hover over a figure, but still keep the toolbar at the top of the window (i.e. the one that always stayed at the top in previous versions of Matlab)?
I have already tried to use 'Toolbar','None' but that just removes the toolbar completely from both the figure axes and from the top of the window. I want it just removed from the figure axes.


Do you want to only remove the popup menu, or do you also want to add back the controls in the toolbar?
Then my answer should do what you need. Have you tried it?

Sign in to comment.




2 Answers

Answer by Image Analyst
on 26 Jul 2019
Edited by Image Analyst
on 26 Jul 2019

See the official toolbar answer here in this Mathworks Support Answer
In short:
addToolbarExplorationButtons(gcf) % Adds buttons to current figure's toolbar


Sign in to comment.

Answer by Rik
on 26 Jul 2019

In the same thread image analyst refers to, you can also find my suggestion for both a portable solution (see below), and a suggested edit for startup.m to make the change permanent, but only on your copy of Matlab.
function fig=figure_legacy(varargin)
%Open a figure with the old style (pre-R2018b) of plot interactions
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', ...


Sign in to comment.