Saving the plot after modifications in the GUI - Matlab
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Adam Mariusz Kuryla
am 11 Nov. 2019
Kommentiert: Adam Mariusz Kuryla
am 12 Nov. 2019
Hi
I have a problem with capturing the plot in the gui and exporting it to the png. I tried already saveas, export_fig and getframe, but still I am not getting that what I want. Basically I am creating the graph, which can be then modified with the use of displayed tools. And at the end I want to save only the plot in good quality with the "Save plot" button , that would simly screenshot or save the plot with all modifications. It is worth to mention that when I am using previously mentioned fuctions it is saving the screenshot of the whole gui, not just plot. I already checked internet to get the answer, but still my problem is not resolved.
0 Kommentare
Akzeptierte Antwort
Ankit
am 12 Nov. 2019
Hi Adam,
In the below example, first you need to copy the UIAxes to the temporary figure. And then you can save it as *.png.
function saveplot_Callback(app, event)
% Create a temporary figure with axes.
fig = figure;
figAxes = axes(fig);
% Copy children (lines).
copyobj(app.UIAxes.Children, figAxes);
% Copy titles and labels. You can modify this based on your requirement.
copyobj([app.UIAxes.XLabel app.UIAxes.YLabel app.UIAxes.Title], figAxes);
% Save as *.png file.
saveas(fig, 'myFigure.png');
close(fig);
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!