reset GUI axes properties, including position etc

2 views (last 30 days)
Hello,
I have an axes object within a GUI that is subsequently used for different images/plots.
How can i reset all properies of the axes object befor using it again?
i tried the cla and reset command, but it does not restore the original size (important when turning colorbars on and off) nor do the caxis values get reset. I could hardcode these things, but isthere a convenient way?
i thought about copying the axes handle during startup of the gui and paste it later, but i did not succeed:
%...
function gui_OpeningFcn(hObject,eventdata,handles,varargin)
handles.output=hObject;
a=get(handles.myaxes);
handles.myaxesbackup=a;
guidata(hObject);
function pushbutton1_Callback(hObject,eventdata,handles)
% do something with the axes, e.g. plot
function pushbutton2_Callback(hObject,eventdata,handles)
set(handles.myaxes)=handles.myaxesbackup; % <== POINT OF THIS QUESTION
% do something ele with my axes
anybody can help me out? The problem i try to solve is that the appearence of plots on the axes depend on what was done before with the plot. for example, using colorbar decreases the size of the x-axis, and colormaps are taken from the previous plot. thanks.
  1 Comment
carmen
carmen on 13 Mar 2012
i guess a workaround is to use
h=figure;
% some figure code
close(h)
this fixes my froblem technically, however, he plot is not anymore embedded into the gui

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Object Programming 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!