MATLAB Graphic Handle Properties Summary

Source: Internet
Author: User
Tags dashed line

The original is the snow-diffuse blog
Http://blog.sina.com.cn/s/blog_4b9b714a0100cce2.html
These two days in the look at the handle graphics aspect of things, the following is I in the process of reading the study notes, a more detailed description of the handle and its closely related to the various graphic objects and their properties. Hope to be a beginner of the Matlab interface design of friends have some help.

GUI Learning notes:

Common functions for handle graphs:
(1) Get (h) Returns the value of all property names of the drawing objects specified by the handle values H and the corresponding property values
(2) A = Get (h) returns an array of property structures for the drawing object specified by the handle value H, and the field name of the array is the property name of the object.
(3) A = Get (0, ' factory ') returns the default defined value for all properties that can be set by the user.
(4) A = Get (0, ' FactoryObjectTypePropertyName1 ', ' FactoryObjectTypePropertyName2 ',...) Returns the property value specified by the specified object type, factoryobjecttypepropertyname as a keyword, consisting of a character factory and a graphic object type (such as figure) and a property name, such as color.
A = Get (0, ' Factoryfigurecolor ') returns the value of the color property of the figure object.
(5) A = Get (H, ' DefaultObjectTypePropertyName1 ', ' DefaultObjectTypePropertyName1 ',...) Returns an object with a handle value of H specifying the default value for the property. such as "Defaultfigurecolor".
(6) A = Get (h, ' Default ') lists the default property values for all properties of the H object
(7) A = set (h) Returns the value of the configurable property for all the property names of the drawing object specified by the handle value H, A is a structure array, stores the object's property name, and its field value is the corresponding property value. The default value is enclosed in {} for the property value.
(8) Set (H,A) uses the specified property value to set the object property specified by the handle value H, A is a structure array whose field name is the property name of the object, and the field value is the corresponding property value.
(9) A = set (0, ' factory ') returns the properties of all objects for which the user can set default values, and displays the values of the properties that can be set.
A=set (0, ' factoryobjecttypepropertyname ') returns all possible property values for the specified property name Factoryobjecttypepropertyname in all objects.
(one) A = set (H, ' property name ', ' attribute value ') sets the property value corresponding to the property name of an object with a handle value of H.
Set (H, ' DefaultObjectTypePropertyName1 ', ' DefaultObjectTypePropertyName2 ',...) Sets the property default value for a specific property name for an object with a handle value of H.
H = Findobj; Returns the handle value of the root object and all its child objects
h = findobj (h); Returns the handle value of the H variable
H = findobj (' attribute name ', ' attribute value '); Find the matching object handle value based on the object's property name and property value.
H = Findobj (objecthandles, ' attribute name ', ' attribute value '); Find the object handle value that matches the object's property name and property value based on the list of qualified objects
GCF returns the handle value of the current Figure object
GCA returns the handle value of the current axes object
GCO returns the handle value of the current mouse click, which can be any graphic object except the root object, and Matlab stores the handle value of the current drawing object in the Currentobject property of the figure

Attribute chapter of a figure object
(1). ^ is the power multiplier for each element of the matrix, ^ is the power multiplier of the number.
(2) set (handle) lists all properties of an object with a handle value of handle
Get (handle) lists the properties that can be set, in addition to those listed above
Reset (handle) changes all properties to default values
Delete (handle) Removes a drawing object with a handle value of handle
(3) Use Set (handle, ' property name ') to get all the property values that can be set under the property name of the object with a handle value of handle
Set (GCF, ' units): get [inches | centimeters | normalized | points | {pixels} | Characters], where the default value is in curly braces
(4) CLF reset; Close the window and reset its properties to the default value.
(5) CLOSEREQUESTFCN, valid value is a string or function handle (ex plus @)
Functions defined by CLOSEREQUESTFCN are defined when you close the drawing window or leave Matlab
(6) CREATEFCN, when Matlab establishes an object (such as a figure object, which opens a drawing window), the callback program defined by CREATEFCN is triggered. such as set (0, ' DEFAULTFIGURECREATEFCN ', ' Set (GCBO, ' ' integerhandle ', ' off ') '), that is, set the default value of the root object, so that each time a figure object is created, Will specify a handle value that is not an integer. (When the user does not specify a handle value)
(7) Displays the key name that is pressed on the keyboard in the current window.
Set (GCF, ' KEYPRESSFCN ', ' Get (GCF, ' currentcharacter ') ')
(8) Color valid value is Colorspec
Colorspec table:
RGB abbreviation
[Y_yellow]
[101] M_magenta
[011] C_cyan
[R_red]
[010] G_green
[001] B_blue
[111] W_white
[K_black]
(9) Linspace (A,B,C): A initial B end C linear segment Count Linspace (A, b) default 100 times
Currentobject: Valid value is a graphic object handle value: Returns the handle value of the object currently selected by the mouse in the drawing window
(one) Currentpoint: RMS [x-coordinate, y-coordinate] returns the position of the last mouse click in the drawing window, with get (GCF, ' Currentpoint ') returning the current position of the mouse click in the window
DELETEFCN: Valid value: A string or function handle that triggers the callback program defined by DELETEFCN when the object is deleted (figure here).
Dockcontrols: Valid value is on/off, default on, controls whether the window embedding effect is available.
Hittest: Valid value on/off, determines whether the object can be selected with the mouse as the current object.
(integerhandle): Valid value on/off, determines whether the type of object handle value is an integer or floating point decimal.
(+) Interruptible: Valid value on/off, need to interrupt the program during execution and priority to execute other programs to set this property to ON. That is, the Interrupptible property is used to control when callback execution can be interrupted by other events (such as the mouse pressing other control objects at this time), on is interrupted, off will execute the current callback, and then to perform other callback.
KEYPRESSFCN: Valid value is a string or a function handle. When the user presses any key on the keyboard in the Figure window, the callback program defined by KEYPRESSFCN is executed.
Figure (' KEYPRESSFCN ', ' fprintf (' currently pressing the%c key on the keyboard \ n ', get (GCF, ' Currentcharacter ')) When you press a key on the keyboard in the Figure window, the corresponding character is immediately returned, which allows you to determine what action to take when the character key is pressed.
When the value specified by this property is a function handle, MATLAB treats the function as a structure that contains the following fields--character (the characters displayed as a result of the pressed keys on the current keyboard). Modifier (contains one or more cell arrays (such as ctrl,alt,shift, etc.) that identify the name of the keystroke character on the keyboard, key (which displays the pressed key).
WINDOWBUTTONDOWNFCN: Valid value is a string or function handle
When the mouse presses any key within the drawing window, the callback defined by WINDOWBUTTONDOWNFCN is triggered to produce the corresponding action.
(WINDOWBUTTONMOTIONFCN): Valid value is a string or function handle
When the mouse presses the mouse button to move within the drawing window, the callback defined by WINDOWBUTTONMOTIONFCN is triggered to produce the corresponding action.
(WINDOWBUTTONUPFCN): Valid value is a string or function handle
When the mouse releases any mouse key within the drawing window, the callback defined by WINDOWBUTTONUPFCN is triggered to produce the corresponding action.
Currentaxes valid value is the handle value of the current axis and returns the current axis handle value. Assuming that an axis handle value is A_h, you can use either axes (a_h) or set (GCF, ' currentaxes ', a_h) to make the axis with the a_h of the handle the current axis.
Currentcharacter: A valid value is any character that returns the last character entered by the user in the drawing window, that is, the character key that has just been pressed on the keyboard is stored in the currentcharacter, usually in KEYPPRESSFCN.
Currentobject valid value is the handle value of the drawing object, returning the handle value of the object currently selected by the mouse in the drawing window.
(24) Vectors with valid values of two elements [x-coordinate, y-coordinate]
Returns the position of the last mouse click in the drawing window, shared with WINDOWBUTTONMOTIONFCN,WINDOWBUTTONUPFCN. Using Get (GCF, ' currentpoint ') returns the position where the mouse is currently clicked in the window.

Axes properties of an object
(1) Title (' New ', ' Color ', ' r '), name the axis new, red
Title ({' This title ', ' Have 2 '}); titles named two lines
(2) Units: valid value is Pixels/normalized/inches/centimeters/points/characters
Determines the units of measure for various positional properties, as opposed to the lower-left corner of the window. When set to pixels, in pixels, when set to normalized, in coordinates, the lower-left corner of the screen is [0,0] and the upper-right corner is [1.0,1.0].
(3) grid on: Displays the grid in the image.
(4) Children: Controls the Axes object's sub-objects, namely image\light\line\patch\rectangle\surface and text and other objects, can be obtained by get (GCA, ' children ') To return a vector of the handle values that comprise the child objects of the current axis.
(5) Font properties:
Fontangle font angle (normal or italic italic/oblique)
FontName Font Name
FontSize Font Size (units determined by fontunits)
Fontunits font units (points/normalized/inches/centimeters/pixels)
FontWeight font weight (Normal/bold/light/demi)
GridLineStyle determines the style of the Axis gridlines, '-' solid line '-' for dashed ': ' For Point line '-. ' Dotted line for dots
Plot (1:10); grid on;set (GCA, ' GridLineStyle ', '-. '); The grid line displayed on the current axis is a point-dashed line
(6) LineWidth defines the axis width of the x, Y and Z axes (defined in point units)
(7) Nextplot: Valid value is Add|replace|replacechildren, default is replace
Add means that using the current axis, adding a new graphic object to this axis is generally reserved, and replace means that all the properties of the axis are reset (except position), that is, the current axis and its child objects are deleted before drawing. Replacechildren means that all child objects in the current axis are removed, but all properties of the axis are not reset
(8) Outerposition determines the position of the outer boundary of the axis. Consists of a position vector [left,bottom,width,height], where left,bottom represents the position relative to the lower-left corner of the drawing window, Width,height represents the area size, and defaults to [0 0 1 1]
(9) position consists of a position vector [left,bottom,width,height], which determines the position of the axis
Tag defines the rollout for this axis, because each object has its own unique identifier, tag, to facilitate the findobj function to find the axis handle value.
(one) visible determines whether the axis is visible
Set (GCA, ' Xgrid ', ' on ') to draw an x-axis vertical grid line
Set (GCA, ' GridLineStyle ', ': ', ' linewidth ', 3) sets the gridline line type and width
Set (GCA, ' box ', ' on ') plots the axis box
Set (GCA, ' XScale ', ' linear '); set the x-axis scale to linear
Set (GCA, ' Yscale ', ' Log '), set y-axis scale to logarithmic
Disp () displays an array, but does not display its array name
Disp (' Corn Oats Hay ')
Disp (rand (5,3))
which results in
Corn Oats Hay
0.2113 0.8474 0.2749
0.0820 0.4524 0.8807
0.7599 0.8075 0.6538
0.0087 0.4832 0.4899
0.8096 0.6135 0.7741

Pause:pause, by itself, causes m-files-to-stop and wait for-you-press any key before continuing.

Example: Plot (1:10); set (GCA, ' Yscale ', ' log ');
Disp (' Press the ENTER key ');
Pause
Set (GCA, ' yscale ', ' linear '); In this case, press the ENTER key to change the y-axis scale from logarithmic to linear.
(+) Xtick,ytick,ztick: Controls the position of the x, y, z axis coordinate ticks, that is, the position of the tick marks on the control axis, and the position of how many values will go to the next tick, along with Xticklabel, Yticklabel, The Zticklabel property to adjust. See the routine for details.
The following settings are in the same way:
Set (GCA, ' Xticklabel ', {' 1 '; ') 10 '; ' 100 '})
Set (GCA, ' Xticklabel ', ' 1|10|100 ')
Set (GCA, ' Xticklabel ', [1;10;100])
Set (GCA, ' Xticklabel ', [' 1 '; ') 10 '; ' 100 '])
(+) Findobj: Find

Line Object
When a user establishes a line object, it triggers the corresponding operation of the callback defined by CREATEFCN, and similarly, when a line object is deleted, the callback generated by DELETEFCN is triggered to produce the corresponding action. The following program establishes a line object and sets DELETEFCN as a problem dialog box, and when the line object is deleted, its Problem dialog box is displayed to ask the user.
(1) Clipping: Valid value is on/off, default value is on
Sets whether the axis basket can be clipped, and if set to off, the drawing line object can be drawn beyond the axis frame.
(2) LineWidth: The valid value is the pure quantity (relative to the vector, only the size but no direction), the point is the unit.
(3) Marker: The valid value is the character, determines the line object's mark type, has the +,o,*,.,x,s,d, and so on
(4) Markersize: The valid value is the pure quantity, the unit is the point, the marker size.
(5) Uicontextmenu: Valid value is the handle value of the Uicontextmenu object, defines the Uicontextmenu menu associated with the line object, Therefore, when the user sets the property Uicontextmenu of the line object to the tag name of the associated Uicontextmenu object, Uicontextmenu can right-click on the line object to display the Uicontextmenu menu.
(6) Tag: Valid value is a string that defines the rollout (that is, the tag) of the Rerouted object
(7) Type: Valid value is a string (read-only), here is the ' line ' string.
(8) Xdata,ydata,zdata: The valid value is the coordinate array, specifies the data point which produces the line, if is 2D environment then Xdata, Ydata need to have the same number of data, but Zdata is the empty matrix; 3D Environment Xdata,ydata, All zdata need to have the same number of data.
Example: X=0:5,y=x+10;line (' XData ', X, ' Ydata ', y);

Patch Object
The patch function does not want to create functions (fill and area) in other advanced areas, but simply adds the patch object to the current axis.
Use: Patch (X,Y,C)
Adds a two-dimensional filled patch object to the current axis, x and Y to define the position of the patch object vertices, and if x, Y is a matrix, Matlab produces multiple polygons per line of elements.
Example: x = [0 0;0 1;1 1];
y = [1 1;2 2;2 1];
z = [1 1;1 1;1 1]; (x (n), Y (total), Z (n) is the first vertex of the first polygon, X (2,1), Y (2,1), Z (2,1) is the second vertex of the first polygon, and so on)
TColor (1,1,1:3) = [1 1 1];
TColor (1,2,1:3) = [. 7.7.7];
Patch (X,y,z,tcolor); (TColor is a 1*2*3 three-dimensional matrix)

Surface Object
Surface can build a surface object where the column index value of the matrix data is the x-coordinate, and the row index value is the y-coordinate, and the value of each element of the matrix is the z-coordinate.

Image Object
Image (c) displays the matrix C as an image, and each element of C defines the color of the matrix segment in an image.
Image (X,y,c) where x and y are vectors of 2 elements, respectively, specifying the range of the x-axis and y-axis rollout axes. C is the image matrix.

Text Object
(1) The text (x-coordinate, y-coordinate, ' string ') displays the string in the graph at the specified position, x, Y.
(2) When the editing valid value is On/off,off, the user cannot edit it directly on the text object while performing the GUI operation, and can edit it after changing to on.
(3) HorizontalAlign valid value is Left/center/right determines the alignment of the horizontal direction of characters in the text object.
(4) The interpreter valid value is Tex/none, which determines whether a Tex character annotation is available in the text object and, when set to Tex, allows the user to enter the Tex character under the string property. The following is an equation that establishes a text object at the [. 5.5] Point position of the window and a font size of 16 points. (shows a double integral)
Text (' Interpreter ', ' latex ', ' string ', ' $$\int_0^x\!\int_y DF (u,v) $$ ', ' position ', [. 5.5], ' fontsize ', 16)
(5) A string is a valid value that represents what string to display.
(6) Verticalalignme valid value is Top/cap/middle/baseline/bottom determines how the text object is aligned vertically.

Loading An example below, is Ilovematlab forum a owner's reply
X=0:0.5:10;
>> y1=sin (x);
>> Y2=cos (x);
>> plot (x,y1, ' R ', X,y2, ' G ')
>> findobj (GCA, ' Color ', ' r ')

Do not want the curve directly delete handle on it can be

MATLAB Graphic Handle Properties Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.