Figure toolbar disappears when selecting 3-D rotate

2 ビュー (過去 30 日間)
Luca Amerio
Luca Amerio 2019 年 6 月 18 日
回答済み: Hari 2024 年 3 月 28 日
The following code produces a figure without the standard toolbar, but leaving the new "axes" toolbar with the zoom, rotate, datatip and brush tools.
hfig = figure();
delete(findall(hfig,'Type','uitoolbar'));
axes()
[x,y,z] = peaks(25);
surf(x,y,z)
This works perfectly fine with most tools, except "Rotate 3-D". When I select "Rotate 3-D" the toolbar disappears and there's no way (at least, that I found) to disable the Rotate3D tool and bring back the toolbar.
What's even more "funny" is that you don't even need that tool, as dragging inside the axes will already perform a 3d rotation without triggering the problem.
Why this happens? Is there a way to prevent the toolbar from disappearing? And if there is not, there is a way to disable the "Rotate 3D" tool, leaving the others?

回答 (1 件)

Hari
Hari 2024 年 3 月 28 日
Hi @Luca Amerio. I hope you are using matlab 2018b. From R2018b onwards, options such as the zoom, pan, datatip, etc are no longer associated with the figure toolbar and are part of "axes" toolbar. These options appear when you hover your mouse pointer over the plot. Moreover, zooming in and out can be performed using scroll bar and 3D rotation can be done using left mouse click+drag. If you want the zoom, pan and rotate options to be in the figure toolbar, certain changes need to be done to the above code snippet . I have done those changes and they are as follows:
hfig = figure();
% delete(findall(hfig,'Type','uitoolbar'));
axes()
[x,y,z] = peaks(25);
surf(x,y,z)
% setting of the figure toolbar to have the rotate and other options.
set(groot,'defaultFigureCreateFcn',@(hfig,~)addToolbarExplorationButtons(hfig))
% Switching off the visibility of axes tool bars
set(groot,'defaultAxesToolbarVisible','off')
This will make the figure window to have the zoom, pan and rotate options in the figure toolbar itself.

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by