How can i stop the axtoolbar from hiding?

조회 수: 10 (최근 30일)
Matthias Fath
Matthias Fath 2024년 5월 13일
댓글: Cedric 2024년 9월 26일
I want the axtoolbar within a 2D-Plot to be shown always, not only when i put the mouse in the upper right part of the plot. Can this dynamic hiding function be disabled? If there is a solution, would it also work in App Designer?
Regards,
Matthias
  댓글 수: 3
Mann Baidi
Mann Baidi 2024년 5월 14일
Hi, Can I know the use case for a better solution.
Matthias Fath
Matthias Fath 2024년 5월 14일
I am building an App and for the plots i am quite happy with the default functionalities in axtoolbar, all i do is restricting them to 'export','pan','datacursor','zoomin' and 'restoreview'. I am not so happy with the responsiveness of the toolbars hiding and unhiding. It is annoying and sometimes the toolbar hides, when i move the mouse towards it, which is not a good user experience. Also the app will be used by people, not familiar with matlab at all. By always displaying the toolbar i want to make it easier for them to see the possible interacctions with the plots.
Rergards,
Matthias

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

답변 (1개)

Suraj Kumar
Suraj Kumar 2024년 5월 23일
Hi Matthias,
In the "axtoolbar," there isn't a direct method to disable the dynamic hiding feature. However, as a workaround, the options within the "axtoolbar" can be made permanently visible on the figure toolbar. This can be achieved by customizing the toolbar and reinstating the traditional exploration buttons.
For better understanding you can refer to the below code snippet:
function [] = figToolbarFix(hFig)
% enable the old 'zoom', 'rotation', 'pan', 'data tips'buttons
addToolbarExplorationButtons(hFig)
[img1,map1] = rgb2ind(imread(fullfile(matlabroot,...
'toolbox','matlab','icons','tool_plottools_show.png')),32);
[img2,map2] = imread(fullfile(matlabroot,...
'toolbox','matlab','icons','pageicon.gif'));
% Convert image from indexed to truecolor
icon1 = ind2rgb(img1,map1);
icon2 = ind2rgb(img2,map2);
% Get hiddenhandle of the toolbar we want to append to.
hToolbar=findall(gcf, 'type', 'uitoolbar');
% for a single toggle that opens/closes the previous state of the plot tools
uitoggletool(hToolbar,'CData',icon1,...
'TooltipString','Property Editor',...
'OnCallBack','plottools(''on'')',...
'OffCallBack','plottools(''off'')',...
'Separator','on',...
'HandleVisibility','off');
end
After customizing the icon arrangement, you can hide specific "axtoolbar ”items using the following command:
ax = gca;
ax.Toolbar.Visible = 'off';
Output:
Similarly, in App Designer, you can incorporate buttons and tailor their behavior to replicate this functionality by adjusting the callback function as needed. For instance, to implement a "zoom-in" feature, you can insert the following code into the callback function:
zoom(app.UIAxes,'on');
You can refer the following links for better understanding:
Hope this helps!
  댓글 수: 3
Suraj Kumar
Suraj Kumar 2024년 9월 13일
You are welcome.
Cedric
Cedric 2024년 9월 26일
For YEARS, I have been imagining the meeting at MATLAB HQ where they decided to take my most-used buttons and make them invisible until you de-select the select tool and mouse-over the axes.
That's 90 minutes of my life matlab!!!

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

카테고리

Help CenterFile Exchange에서 Data Exploration에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by