How to reconstruct a figure with a "line" variable
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nick Brewer
am 15 Jun. 2019
Beantwortet: Walter Roberson
am 16 Jun. 2019
I have something like
% Code running to generate x- and y- data
h = plot(xData, yData,'propertyname', 'propertyvalue')
save('Filename')
When I open 'Filename.mat' I can see 'h' in the workspace with all the properties of the line I plotted as '1x1 Line'.
I would like to, in a different script, create a new figure and axes and plot that line with all the properties it has. I know how to get all the properties using h.XData, h.YData, h.MarkerSize, etc, but I would like there to be somemore efficient command like
f=figure
set(f,'addplot',h)
Thanks!
2 Kommentare
dpb
am 16 Jun. 2019
"...would like there to be somemore efficient command"
There is --it's savefig and openfig
Akzeptierte Antwort
Walter Roberson
am 16 Jun. 2019
You cannot directly copy a line() object to a figure. You can copy a line() object to an axes, or you can copy an axes to a figure.
%entire axes
f = figure;
hax = get(h,'Parent');
copyobj(hax, f);
or
%line only
f = figure;
fax = axes('Parent', f);
copyobj(h, fax);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Printing and Saving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!