Figure toolbar disappears when selecting 3-D rotate

13 vues (au cours des 30 derniers jours)
Luca Amerio
Luca Amerio le 18 Juin 2019
Réponse apportée : Hari le 28 Mar 2024 à 12:06
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?

Réponses (1)

Hari
Hari le 28 Mar 2024 à 12:06
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.

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by