How to put an axes into the foreground layer in GUI (made by GUIDE)?

I have a GUI with several axes defined. When running the program I would like to select an axes and enlarge or move it inside the figure window. I can do it with the selection tool. However the layer position of individual axes depend on the order defined in the GUIDE, when I was designing the figure window. I cannot change it when the program is running. So the axes is enlarged behind another axes, and therefore they are not visible properly.
How to put axes into foreground when I am running the program?

Réponses (2)

uistack() works on axes.

13 commentaires

Csaba
Csaba le 15 Mai 2018
Modifié(e) : Csaba le 15 Mai 2018
Thanks, it is working, although I have found another solution: "axes(axes_handle)".
Although I have a problem with it. When "plotedit" property is on for the figure (you need it for selecting the proper axes and I have a toolbar icon for it), I cannot use ButtonDownFcn of that axes. The callback is simply not executed. So If I really want to change the size of an axes, first I have to click on it while "plotedit" is off, then switch plotedit to on and then you can resize the axes. It is ugly.
Any suggestions???
Those modes are not compatible. plot edit needs control over all of the clicks.
You could use axes or figure button down fcn callbacks to select the axes, but at the moment no good method for interactively resizing an axes is coming to mind.
I am always running into such "features". I think it is an elementary need.
It is quite unlikely that this will ever be implemented in GUIDE. GUIDE is only being maintained if changes to MATLAB make its internal code incompatible. All of the effort is being placed in App Designer. GUIDE will be retired when App Designer has been expanded for all of the major functionality that GUIDE has now.
I do not see what GUIDE has to do in this case. The figure window with several axes can be done without GUIDE. Then the same problem exists.
It is not a GUIDE problem.
I think "plotedit" should contain an option in the toolsmenu "bring to front" "send to back" etc.
Jan
Jan le 16 Mai 2018
Modifié(e) : Jan le 16 Mai 2018
@Csaba: You are right. I've removed my comment to avoid confusing readers.
If all you want to do is to resize/move the axes, what about using a context menu to start this? I'm not sure, if the function from the plotedit tools can be reused directly, but you can search where it is triggered by using the profiler: profile on, then select the axes and resize it, profile report. Maybe it is not possible to call this tool directly. But you could write your own resize function for an axes object. The older function selectmoveresize was useful, but now plotedit is recommended, although this is an indirection.
"I do not see what GUIDE has to do in this case"
You used GUIDE in your title, and you specifically referred to layering order created by GUIDE.
plotedit was designed for HG1, and ignores figures created by the new App Designer.
Csaba
Csaba le 16 Mai 2018
Modifié(e) : Csaba le 16 Mai 2018
@Walter: Yes, it is true, but later, as we discussed the problem, it turned out that GUIDE has nothing to do with it. By now I have made a pilot program programmatically, reproducing the same behaviour. I can bring forward with ButtonDownFcn any axes, but plotedit should be off. Then I have to change to plotedit on and resize. It is still ugly. I can improve it a little bit including the plotedit on command into ButtonDownFcn Callback, but then I have to switch plotedit off again. AND it is not necessarily the object I have clicked on is selected by plotedit. And I always forget to switch it off! (Silly me!)
I am not familiar with App Designer so I cannot comment on it. I do not know if the same problem exists there or not. If you are sure that my problem can be solved in App Designer I will be happy (may be not) to learn it.
The problem is not solved in App Designer because plotedit cannot be used with App Designer.
The efforts for graphics tools are being directed to App Designer.
The limitation has to do with the fact that the plot editor UI Mode Manager takes over callbacks, including axes button down functions, temporarily disabling whatever button down function you might have programmed. This is because there is no separate callback for left-mouse and right-mouse, so the plot editor cannot put in a right-mouse editor menu without affecting use of left-mouse. And besides, axes button down fcn are defined to fire on all mouse buttons, with it being up to the user to define behavior for specific buttons if they want to.
I posted a work-around for HG1 for R2014a and before. Yair posted an update for HG2 in his http://undocumented-matlab.com . I do not happen to recall limitations after Yair's hacks.
"The problem is not solved in App Designer because plotedit cannot be used with App Designer."
It means that you cannot resize objects in App designer?
I do not know at the moment if you can resize objects in App Designer. The question at hand is whether you can use plotedit with App Designer, as you are locked into using plotedit in your workflow.
What I really want is to select an axes from many in a figure and resize it. plotedit is just a tool for resizing. And, of course, I want to put it in the foreground because otherwise you cannot see what you just made bigger because it is hidden below other axes.
So any solutions are welcome. I am not locked to plotedit.

Connectez-vous pour commenter.

Jan
Jan le 17 Mai 2018
What about FEX: axisshift? This would avoid the limitations of plotedit.

2 commentaires

Thanks, I will check!
OK, I have checked axshift. As it is, it is not very good, i.e. in some cases (i.e. when I click to a subplot) it flickers, I have to use the figure(x) figure, but not the GUIDE figure, in order to resize the subplot, I need to go to a right click menu.
Still the best would be a "send to back", "send to front" kind of right click command in plotedit.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Develop Apps Using App Designer dans Centre d'aide et File Exchange

Question posée :

le 10 Mai 2018

Commenté :

le 25 Mai 2018

Community Treasure Hunt

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

Start Hunting!

Translated by