make axes bigger when mouse clicked
2 views (last 30 days)
hi matlab community,i am a begginer in matlab gui, i have 7 axes in my gui i don't know if it's possible that when I click or pass the mouse on one of the axes it will be shown bigger in the middle of the gui. thanks for advance
AstroGuy1984 on 25 Apr 2017
When you say "7 axes" are you meaning 7 separate axes objects or 7 series within a singular axes object? I am assuming you mean 7 separate plots and you want to be able to "blow up" a clicked plot into the main plot.
Nonetheless, I believe where you will want to start with is the ButtonDownFcn property within the Axes object in question. So when you instantiate your axes object, set the property there as such:
axes('Parent', fig_handle, ..., 'ButtonDownFcn', @function_name);
where ... are all the other properties for your axis when you create it. If you are using GUIDE, you can just set that one property in the normal way using:
set(axes_handle, 'ButtonDownFcn', @function_name);
From there you will want to make a callback function (name it whatever you are setting the ButtonDownFcn to be) and give it similar arguments to what you'd get in a regular callback:
function function_name(hObject, event)
hObject will be the Axes object clicked and the event object will contain a property to tell you where it was hit. From there, you now know what plot was clicked for copying into a larger plot.
It's hard to tell you where to go from there without knowing about the destination, but I'd heavily suggest using the copyobj() function for copying series within a plot.