Reputation: 455
I have a cell array h
with handles, which contains a line object:
Line with properties:
Color: [0 0 0]
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerSize: 6
MarkerFaceColor: 'none'
XData: [1.9023e+06 1.9023e+06]
YData: [1.4689e+07 1.4689e+07]
ZData: [1×0 double]
When I create a new figure, how do I display h{1}
with all its properties? This is not working since plot does not retain color and other properties:
figure;
plot(h{1].XData,h{1].YData);
Upvotes: 1
Views: 41
Reputation: 60444
You can use copyobj
to copy over the graphics element to a new figure:
figure;
h = plot(randn(100,1),'ro');
figure;
copyobj(h,gca);
Upvotes: 2