How to transfer axes from GUI to figure and save as PDF
조회 수: 5 (최근 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!