How to transfer axes from GUI to figure and save as PDF
2 次查看(过去 30 天)
显示 更早的评论
I have a GUI (handle = main) that allows the user to select some data and then plots it on the axis built into the GUI (handle = axes1)
After the plot is generated, I'm trying to save the image as a PDF, but I'm running into the following issues:
1) copyobj(handles.axes1,h_fig) doesn't keep both primary and secondary axes, and upon closing h_fig, the secondary axis from the GUI disappears!
2) copyobj(get(main,'children'),h_fig) gets EVERYTHING form the GUI including the push buttons, listboxes, etc which I don't want. Even this method, the positioning of the legend isn't copied over correctly.
3) i tried to use the export_fig script submission from Oliver Wood and it has the same issue. I tried both export_fig, as well as isolate_axes functions, both only keep the primary axis info.
Am i doing something wrong? is the secondary axes hidden when it gets copied? and once copied, does the visibility get set to invisible on the original GUI axes?
Any help is greatly appreciated!
0 个评论
回答(2 个)
Mahdi
2013-3-25
I had this problem a while ago. I couldn't figure out how to solve it.
I figured the best way was to open up a new figure (In the callback function, open a new figure, say figure 1 - type figure(1)), then plot the same data that you want, save figure 1, then close figure(1). This is definitely inefficient though, but I haven't found a different way.
0 个评论
David C
2013-3-25
1 个评论
Oliver Woodford
2013-6-19
David: If you call export_fig([h1 h2], 'test.jpg'), where h1 and h2 are the two axes handles returned by plotyy, does that work?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!