Hf_1=figure('color', 'white');
figure全部属性
Alphamap: [0 0.0159 0.0317 0.0476 0.0635 0.0794 … ]BeingDeleted: offBusyAction: 'queue'ButtonDownFcn: ''Children: [0×0 GraphicsPlaceholder]Clipping: onCloseRequestFcn: 'closereq'Color: [1 1 1]Colormap: [256×3 double]ContextMenu: [0×0 GraphicsPlaceholder]CreateFcn: ''CurrentAxes: [0×0 GraphicsPlaceholder]CurrentCharacter: ''CurrentObject: [0×0 GraphicsPlaceholder]CurrentPoint: [0 0]DeleteFcn: ''DockControls: onFileName: ''GraphicsSmoothing: onHandleVisibility: 'on'Icon: ''InnerPosition: [269 95 560 420]IntegerHandle: onInterruptible: onInvertHardcopy: onKeyPressFcn: ''KeyReleaseFcn: ''MenuBar: 'figure'Name: ''NextPlot: 'add'Number: 1NumberTitle: onOuterPosition: [262.1429 88.4286 573.7143 505.1429]PaperOrientation: 'portrait'PaperPosition: [3.0917 9.2937 14.8167 11.1125]PaperPositionMode: 'auto'PaperSize: [21.0000 29.7000]PaperType: 'A4'PaperUnits: 'centimeters'Parent: [1×1 Root]Pointer: 'arrow'PointerShapeCData: [16×16 double]PointerShapeHotSpot: [1 1]Position: [269 95 560 420]Renderer: 'opengl'RendererMode: 'auto'Resize: onScrollable: offSelectionType: 'normal'SizeChangedFcn: ''Tag: ''ToolBar: 'auto'Type: 'figure'Units: 'pixels'UserData: []Visible: onWindowButtonDownFcn: '' WindowButtonMotionFcn: ''WindowButtonUpFcn: ''WindowKeyPressFcn: ''WindowKeyReleaseFcn: ''WindowScrollWheelFcn: ''WindowState: 'minimized'WindowStyle: 'normal'
Hl_a=plot(rand(4));
Hl_a = 4×1 Line 数组:Line Line Line Line
Hl_a(1)%第一条曲线
AlignVertexCenters: offAnnotation: [1×1 matlab.graphics.eventdata.Annotation]BeingDeleted: offBusyAction: 'queue'ButtonDownFcn: ''Children: [0×0 GraphicsPlaceholder]Clipping: onColor: [0 0.4470 0.7410]ColorMode: 'auto'ContextMenu: [0×0 GraphicsPlaceholder]CreateFcn: ''DataTipTemplate: [1×1 matlab.graphics.datatip.DataTipTemplate]DeleteFcn: ''DisplayName: ''HandleVisibility: 'on'HitTest: onInterruptible: onLineJoin: 'round'LineStyle: '-'LineStyleMode: 'auto'LineWidth: 0.5000Marker: 'none'MarkerEdgeColor: 'auto'MarkerFaceColor: 'none'MarkerIndices: [1 2 3 4]MarkerMode: 'auto'MarkerSize: 6Parent: [1×1 Axes]PickableParts: 'visible'Selected: off SelectionHighlight: onSeriesIndex: 1Tag: ''Type: 'line'UserData: []Visible: onXData: [1 2 3 4]XDataMode: 'auto'XDataSource: ''YData: [0.8258 0.5383 0.9961 0.0782]YDataSource: ''ZData: [1×0 double]ZDataSource: ''
c=get(Hl_a, ‘color’);
set(Hl_a(1),‘color’,[0,0,1])%设置第一条直线为蓝色
set(Hl_a,‘color’,[0,0,1])%设置所有直线为蓝色
通过get和set可以进行句柄的设置。其他可能用到的命令:gca
、gcf
、gco
、findobj
、findall
。
- gcf - handle of the current figure. MATLAB has a concept of a
“current” figure.- gca - handle of the current axes.
- gco -handle of the current object. This returns the handle of the last clicked object. The object could be anything, including axes and figures.
- findobj - find objects with specific properties.
- findall - find objects (including hidden objects).
图像句柄更多的可以参考:
[1]句柄图形系统简介