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.
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:
The last
setcommand uses structxxto set all the values and reproduce your plot. Note that the read-only propertiesro_propsare removed fromxxbefore callingset.EDIT: modified answer to automatically detect read-only properties according to this suggestion.