Is it possible to add an axes toolbar button to the default axes toolbar?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Alexander Halbleib
il 13 Feb 2023
Commentato: Alexander Halbleib
il 13 Feb 2023
Hello,
I've made a toolbar button to help with some of my data analysis. Is it possible for me to add code to my startup.m file to include this button on all default axtoolbar objects that I create, or do I have to create it manually every time?
I like this functionality, but I don't see myself manually creating the button for every plot that I make. I've also used
set(groot,'defaultFigureWindowButtonDownFcn',@highlightOnButtonDown);
to do something similar, but I really like the ability to turn the functionality on and off via the axtoolbar.
For example, the following code creates the below image:
plot(rand(5));
ax = gca;
tb = axtoolbar(ax,{'zoomin','zoomout','restoreview'});
btn = axtoolbarbtn(tb,'state');
btn.Icon = 'highlight_icon.png';
btn.Tooltip = 'Highlight Lines';
btn.ValueChangedFcn = @highlightToggle;


2 Commenti
Mario Malic
il 13 Feb 2023
I have never tried it, but maybe CreateFcn argument supplied to axes might do the trick.
Risposta accettata
Alexander Halbleib
il 13 Feb 2023
2 Commenti
Mario Malic
il 13 Feb 2023
Within createHighlightToggle you can probably put
hold(src, 'on');
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!