How can I add "Edit plot" to tool bar in my own GUI

11 views (last 30 days)
Hi ! I would like to create a GUI with and axes. Axes should have zoom in, zoom out, rotate , pan and normal white arrow which is "Edit plot". To get four this feauters it is enough to click GUIDE "Tollbar Editor" and just add zoom in, pan etc. BUT there is nothing like normal white arrow "Edit plot".I don't want to have all "edit plot" toolbar. I just have interactive plot (user can change position of the point) and I would like user to zoom in, zoom out , pan and then come back to normal arrow again to allow him to interact with plot.
I can write in code viewmenufcn('FigureToolbar'); BUT it give me all toolbar with such buttons like "save" etc. When User click to that "save" button all Matlab crashed totally.
I tried to modify viewmenufcn('FigureToolbar'); in code but its over my programming skill ;)
Please help me :) Janek

Answers (4)

Azzi Abdelmalek
Azzi Abdelmalek on 26 Apr 2013
Edited: Azzi Abdelmalek on 26 Apr 2013
In your gui figure there is an icone called toolbar editor, click on it and add zoom in and zoom out

poprostuJanek
poprostuJanek on 26 Apr 2013
I know how to add zoom in and zoom out. I do not know how to add "white arrow" calles "edit plot". As far as I know you cannot add it using "toolbar editor".

aJackal
aJackal on 28 Feb 2017
I don't think it's possible using GUIDE. However, I found a tutorial showing you how to disable certain items from other default toolbars. So, you could enable the figure toolbar, and then hide the 'save' button.
I have added the following in MyGui_OpeningFcn: %set(hObject,'toolbar','figure');%not needed if you turn the toolbar in guide property inspector a=findall(handles.FigureToolBar,'ToolTipString','Save Figure'); set(a,'Visibility','Off')
Where you can replace 'Save Figure' with the other tool buttons you want to disable. The easiest way to find their tags is to hover the mouse over the button.
Good luck!
https://ch.mathworks.com/matlabcentral/answers/100561-how-do-i-customize-a-figure-toolbar-by-removing-certain-buttons

Sjouke Rinsma
Sjouke Rinsma on 27 Nov 2019
So, I ended up here with the same question, and after some digging around found you can use below function to enable (or disable with 'off') figure editing:
plotedit(fig_handle, 'on');
Just draw your own white arrow toggle icon and add to the code :)

Categories

Find more on Data Exploration 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!