How to transfer axes from GUI to figure and save as PDF
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Mahdi
le 25 Mar 2013
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 commentaires
David C
le 25 Mar 2013
1 commentaire
Oliver Woodford
le 19 Juin 2013
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?
Voir également
Catégories
En savoir plus sur Two y-axis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!