I have been designing a few GUIs to make some data analysis easier. At the end process however I want to be able to save the created plot (and legend) with a push button. I have been looking over past questions and have seen a few ways to approach the problem. My current method of saving the plot is as follows
picname=input('Enter Name for Image: ','s')
saveas(handles.ax, picname, 'jpg')
The problem with this is that I take the whole GUI window instead of just the plot. The two other methods I have seen are the export_fig function and the copyobj method. With the export_fig function I cannot figure out how to tell it to take only the part that I want. With the copyobj method (copy the plot to a figure window and save it there) I cannot figure out how to properly use the function.
Additional info: When I created the axes I defined them with