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

조회 수: 84 (최근 30일)
Ajanae Williams
Ajanae Williams 2019년 7월 23일
답변: Tyson 2023년 5월 20일
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.
  댓글 수: 3
Rik
Rik 2019년 7월 29일
Then my answer should do what you need. Have you tried it?

댓글을 달려면 로그인하십시오.

답변 (3개)

Image Analyst
Image Analyst 2019년 7월 26일
편집: Image Analyst 2019년 7월 26일
See the official toolbar answer here in this Mathworks Support Answer
In short:
addToolbarExplorationButtons(gcf) % Adds buttons to current figure's toolbar

Rik
Rik 2019년 7월 26일
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
fig=figure(varargin{:});
try %#ok if verLessThan is missing verLessThan would have returned true
if ~verLessThan('matlab','9.5')
addToolbarExplorationButtons(fig)
% 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).
defaultAxesCreateFcn=eval(['@(ax,~){',...
'evalc(''set(ax.Toolbar,''''Visible'''',''''off'''')''),',...
'evalc(''disableDefaultInteractivity(ax)'')}']);
set(fig,'defaultAxesCreateFcn', ...
defaultAxesCreateFcn);
end
end
end

Tyson
Tyson 2023년 5월 20일
This should do it.
ax=axes;
axtoolbar(ax,{});

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by