How can I plot from a plot handler?
matlab
Solution
If I understand your question correctly, you want to reproduce a plot using the struct `xx`. The answer ccook provided is on the right track, but here's a shorter way to achieve what you want:
figure
h2 = plot(0);
ro_props = [fieldnames(rmfield(xx, fieldnames(set(h2)))); 'Parent'];
xx = rmfield(xx, ro_props);
set(h2, xx)
The last `set` command uses struct `xx` to set all the values and reproduce your plot. Note that the read-only properties `ro_props` are removed from `xx` before calling `set`.
EDIT: modified answer to automatically detect read-only properties according to this suggestion.
Problem
I have the handler of the plot, or handle of the figure Example: ``` h = plot([1:0.2:10]) xx=get(h) xx = DisplayName: '' Annotation: [1x1 handle] Color: [0 0 1] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerEdgeColor: 'auto' MarkerFaceColor: 'none' XData: [1x46 double] YData: [1x46 double] ZData: [1x0 double] BeingDeleted: 'off' ButtonDownFcn: [] Children: [0x1 double] Clipping: 'on' CreateFcn: [] DeleteFcn: [] BusyAction: 'queue' HandleVisibility: 'on' HitTest: 'on' Interruptible: 'on' Selected: 'off' SelectionHighlight: 'on' Tag: '' Type: 'line' UIContextMenu: [] UserData: [] Visible: 'on' Parent: 173.0107 XDataMode: 'auto' XDataSource: '' YDataSource: '' ZDataSource: '' ``` This handler contains all the plot information, how can I plot out again? This is a simple example with `plot` but it is supposed to work with `slice` as well.