The global solution is not the recommended one as this can cause problems with debugging.
What you would want to do is have the axes handle passed in as one of the arguments to the ButtonDownFcn:
function onPush(ax,callingObj,callingEvent)
% Some code here
plot(ax,...)
end
now the uicontrol for your button expects this function to take only the last 2 inputs, so you need to make an anonymous function handle which can hardcode the axes into this function.
f = @(src,evt) onPush(ax,src,evt);
It is required here that f is defined in a scope where ax is available and that the definition for the uicontrol pushbutton has access to this function handle.
bttn = uicontrol('Style','pushbutton','ButtonDownFcn',f,...);
