Figure double click problem

6 views (last 30 days)
Art
Art on 29 Jul 2015
Edited: Art on 29 Jul 2015
Using R2014b, I created a gui that allows users to select any number of variables to plot in a single figure (1 subplot). I set zoom on and hold on.
I included a uicontrol (popupmenu) within the figure that allows users to select any 1 of the variables to automatically 'zoom in' on. In my case, there could be variables plotted that have Ylims of +/-.05 or +/-10^30, and these variables could be plotted together, so the uicontrol reads the X/Y lims of the selected variable and sets the axis X/YLims to be 10% larger than those values.
This works very well with one exception: I'd like a user "double-click" to return the axis to it's original X/Y lims, similar to what happens when a manual zoom takes place.
In my case, I get the following behavior:
1) if I create a new figure from the gui and then click at least once anywhere in the axes (single or double click), THEN select a variable to zoom in on using the uicontrol, any following double click will always return the axes limits to the original values (desired behavior).
2) If I create a new figure from the gui and immediately use the uicontrol to zoom in on a variable, the X/Y limits of this zoom are used as the "return-to size" when any following double click takes place. (NOT desired behavior)
In other words, Matlab uses the X/Y Limits existing when the first figure 'click' takes place to use as the default axes size.
Is there any way to save the original figure size (ButtonDownFcn?) when the user hasn't clicked in the axes yet?
I did include a setting in the uicontrol that can be selected to size all variables, but this is not ideal or completely user-friendly.

Answers (1)

Art
Art on 29 Jul 2015
Edited: Art on 29 Jul 2015
OK, found a solution:
In the function that sizes the variable when selected from the figure's uicontrol, I just include
zoom out
zoom reset
before doing any size manipulation.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!