Effacer les filtres
Effacer les filtres

Create a subplot that can toggle linkaxes.

1 vue (au cours des 30 derniers jours)
Scott
Scott le 9 Avr 2013
I have a GUI that creates subplots of user selected data. I want the user to have the ability to toggle between having the x-axis of each subplot linked using linkaxes. Is there a way to embed this functionality in the created subplot figure?
Right now, the axes are either linked or they are not; I don't know how to toggle between the two without returning to and using a pushbutton on the main GUI.
Thank you in advance, Scott
  2 commentaires
Jan
Jan le 9 Avr 2013
What is the actual question? You do not want to create a push-button? Why not? Would a corresponding menu in the figure's or subplot's context menu solve the problem? Or what about an entry in the menu bar?
Scott
Scott le 9 Avr 2013
Those are all good suggestions. I would prefer to have a pushbutton on the created subplot figure. I just don't know how to do that. I only know how to add pushbuttons using guide. If there's a way to do it programmatically, so I could create a figure, add subplots, and add a pushbutton, I think that would solve my problem.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 9 Avr 2013
Modifié(e) : Jan le 9 Avr 2013
Open a figure and create a button:
FigH = figure;
ButtonH = uicontrol(FigH, 'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [10, 10, 120, 22], ...
'String', 'Link axes', ...
'Callback', @yourCallbackFcn);
  1 commentaire
Scott
Scott le 9 Avr 2013
Thank you! However, when I use this solution, I lose other plotting tools. Is there a way to keep them (pan, zoom, data cursor, etc) on the figure as well?

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by