Matlabplot函数详解 matlab中plot函数

运行下列命令,
x=linspace(0,2*pi,100);
y=sin(x);
h=plot(x,y);


get(h)
会显示有关plot句柄的所有相关信息。
GET(H) displays all property names and their current values for thegraphics object with handle H.
显示如下:
DisplayName: ''
Annotation: [1x1 hg.Annotation]
Color: [0 0 1]
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerSize: 6
MarkerEdgeColor: 'auto'
MarkerFaceColor: 'none'
XData: [1x100 double]
YData: [1x100 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: 170.3105
XDataMode: 'manual'
XDataSource: ''
YDataSource: ''
ZDataSource: ''

具体每部分的意义如下:
1. DisplayName:
set(h,'DisplayName','Sin Function');
legend show
就是给这个图线起个名字,当运行legend show时,就会显示在legend上。

当绘制很多条图线时,这么做可以避免混乱。 不必在最后用legend函数一一为每条图线命名。
2. Annotation
hAnnotation= get(h,'Annotation');
hLegendEntry = get(hAnnotation','LegendInformation');
set(hLegendEntry,'IconDisplayStyle','off');
设置为off的话,该线条将不在legend里显示。

3.Color: [0 01] 线的颜色
4.LineStyle:'-' 线型
5.LineWidth: 0.5000 线宽

set(h,'Color','r','LineStyle','--','LineWidth',2.0);


6, Marker:'none'标记
7, MarkerSize:6标记大小
8, MarkerEdgeColor: 'auto' 标记的边框颜色
9, MarkerFaceColor: 'none' 标记的颜色

Marker symbol. Specifiesmarks displayed at data points. You can set values for theMarker property independently from the LineStyleproperty. Supported markers are shown in the following table.

Marker SpecifierDescription

'+'

Plus sign

'o'

Circle

'*'

Asterisk

'.'

Point

'x'

Cross

'square' or's'

Square

'diamond' or'd'

Diamond

'^'

Upward-pointing triangle

'v'

Downward-pointing triangle

'>'

Right-pointing triangle

'<'

Left-pointing triangle

'pentagram' or'p'

Five-pointed star (pentagram)

'hexagram' or'h'

Six-pointed star (hexagram)

'none'

No marker (default)


set(h,'Marker','s',...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10);

10,x,y,z的数据,做动画的时候可重置这些值。
XData: [1x50 double]
Matlabplot函数详解 matlab中plot函数
YData: [1x50 double]
ZData: [1x0 double]
例子:

x=linspace(pi,2*pi,50);
y=sin(x);
set(h, 'XData',x,'YData',y);

11.BeingDeleted

on | {off} Read Only

This object is beingdeleted. The BeingDeleted property provides amechanism that you can use to determine if objects are in theprocess of being deleted. MATLAB sets the BeingDeletedproperty to on when the object's delete function callbackis called (see the DeleteFcn property). It remains set toon while the delete function executes, after which theobject no longer exists.

For example, an object's delete function might call otherfunctions that act on a number of different objects. Thesefunctions might not need to perform actions on objects if theobjects are going to be deleted, and therefore, can check theobject's BeingDeleted property before acting.

12.BusyAction

cancel | {queue}

Callback routineinterruption. The BusyAction property enablesyou to control how MATLAB handles events that potentially interruptexecuting callbacks. If there is a callback function executing,callbacks invoked subsequently always attempt to interrupt it.

If the Interruptible property of the object whosecallback is executing is set to on (the default), theninterruption occurs at the next point where the event queue isprocessed. If the Interruptible property is off,the BusyAction property (of the object owning theexecuting callback) determines how MATLAB handles the event. Thechoices are

13.ButtonDownFcn

string or function handle

Button press callbackfunction. A callback that executes whenever you press amouse button while the pointer is over this object, but not overanother graphics object. See the HitTestArea property for informationabout selecting objects of this type.

See the figure's SelectionType property to determine ifmodifier keys were also pressed.

This property can be

Set this property to a function handle that references thecallback. The expressions execute in the MATLAB workspace.

See Function Handle Callbacks for information on how to usefunction handles to define the callbacks.

14.Children

array of graphics object handles

Children of the barobject. The handle of a patch object that is the childof this object (whether visible or not).

If a child object's HandleVisibility property iscallback or off, its handle does not show up inthis object's Children property. If you want the handle inthe Children property, set the root ShowHiddenHandles property toon. For example:

set(0,'ShowHiddenHandles','on')
15.Clipping

{on} | off

Clipping mode. MATLABclips graphs to the axes plot box by default. If you setClipping to off, portions of graphs can bedisplayed outside the axes plot box. This can occur if you create aplot object, set hold to on, freeze axis scaling(axis manual), and then create a larger plotobject.

16.CreateFcn

string or function handle

Callback routine executed duringobject creation. This property defines a callback thatexecutes when MATLAB creates an object. You must specify thecallback during the creation of the object. For example,

graphicfcn(y,'CreateFcn',@CallbackFcn)

where @CallbackFcn is a function handlethat references the callback function andgraphicfcn is the plotting function which createsthis object.

MATLAB executes this routine after setting all other objectproperties. Setting this property on an existing object has noeffect.

The handle of the object whose CreateFcn is beingexecuted is accessible only through the rootCallbackObject property, which you can query usinggcbo.

See Function Handle Callbacks for information on how to usefunction handles to define the callback function.

17.DeleteFcn

string or function handle

Callback executed during objectdeletion. A callback that executes when this object isdeleted (e.g., this might happen when you issue a delete command on the object, its parent axes, or thefigure containing it). MATLAB executes the callback beforedestroying the object's properties so the callback routine canquery these values.

The handle of the object whose DeleteFcn is beingexecuted is accessible only through the root CallbackObject property, which can bequeried using gcbo.

18.HandleVisibility

{on} | callback | off

Control access to object's handle bycommand-line users and GUIs. This property determineswhen an object's handle is visible in its parent's list ofchildren. HandleVisibility is useful for preventingcommand-line users from accidentally accessing objects that youneed to protect for some reason.

Functions Affected by Handle Visibility

When a handle is not visible in its parent's list of children,it cannot be returned by functions that obtain handles by searchingthe object hierarchy or querying handle properties. This includesget, findobj, gca, gcf, gco, newplot, cla, clf, and close.

Properties Affected by Handle Visibility

When a handle's visibility is restricted using callbackor off, the object's handle does not appear in itsparent's Children property, figures do not appear in theroot's CurrentFigure property, objects do notappear in the root's CallbackObject property or in thefigure's CurrentObject property, and axes do notappear in their parent's CurrentAxes property.

Overriding Handle Visibility

You can set the root ShowHiddenHandles property toon to make all handles visible regardless of theirHandleVisibility settings (this does not affect the valuesof the HandleVisibility properties). See also findall.

Handle Validity

Handles that are hidden are still valid. If you know an object'shandle, you can set and get its properties and pass it to any function thatoperates on handles.

19.HitTest

{on} | off

Selectable by mouseclick. HitTest determines whether this objectcan become the current object (as returned by the gcocommand and the figure CurrentObject property) as a resultof a mouse click on the objects that compose the area graph. IfHitTest is off, clicking this object selects theobject below it (which is usually the axes containing it).

20.Interruptible

{on} | off

Callback routine interruptionmode. The Interruptible property controlswhether an object's callback can be interrupted by callbacksinvoked subsequently.

Only callbacks defined for the ButtonDownFcn propertyare affected by the Interruptible property. MATLAB checksfor events that can interrupt a callback only when it encounters adrawnow, figure, getframe, or pause command in the routine. See theBusyAction property for related information.

Setting Interruptible to on allows anygraphics object's callback to interrupt callback routinesoriginating from a bar property. Note that MATLAB does not save thestate of variables or the display (e.g., the handle returned by thegca or gcf command) when an interruption occurs.

21.Selected

on | {off}

Is object selected? Whenyou set this property to on, MATLAB displays selection"handles" at the corners and midpoints if theSelectionHighlight property is also on (thedefault). You can, for example, define the ButtonDownFcncallback to set this property to on, thereby indicatingthat this particular object is selected. This property is also setto on when an object is manually selected in plot editmode.

22. SelectionHighlight

{on} | off

Objects are highlighted whenselected. When the Selected property ison, MATLAB indicates the selected state by drawing fouredge handles and four corner handles. WhenSelectionHighlight is off, MATLAB does not drawthe handles except when in plot edit mode and objects are selectedmanually.

23.Tag

string

User-specified objectlabel. The Tag property provides a means toidentify graphics objects with a user-specified label. This isparticularly useful when you are constructing interactive graphicsprograms that would otherwise need to define object handles asglobal variables or pass them as arguments between callbacks. Youcan define Tag as any string.

For example, you might create an areaseries object and set theTag property.

t = area(Y,'Tag','area1')

When you want to access objects of a given type, you can usefindobj to find the object's handle. The followingstatement changes the FaceColor property of the objectwhose Tag is area1.

set(findobj('Tag','area1'),'FaceColor','red')
24.Type

string (read only)

Type of graphics object.This property contains a string that identifies the class of thegraphics object. For areaseries objects, Type is'hggroup'.

The following statement finds all the hggroup objects in thecurrent axes.

t = findobj(gca,'Type','hggroup');
25.UIContextMenu

handle of a uicontextmenu object

Associate a context menu with thisobject. Assign this property the handle of auicontextmenu object created in the object's parent figure. Use theuicontextmenu function to create the context menu.MATLAB displays the context menu whenever you right-click over theobject.

26.UserData

array

User-specified data. Thisproperty can be any data you want to associate with this object(including cell arrays and structures). The object does not setvalues for this property, but you can access it using the set and get functions.

27.Visible

{on} | off

Visibility of this object and itschildren. By default, a new object's visibility ison. This means all children of the object are visibleunless the child object's Visible property is set tooff. Setting an object's Visible property tooff prevents the object from being displayed. However, theobject still exists and you can set and query its properties.

28.XDataMode

{auto} | manual

Use automatic or user-specifiedx-axis values. If you specify XData (bysetting the XData property or specifying the xinput argument), MATLAB sets this property to manual anduses the specified values to label the x-axis.

If you set XDataMode to auto after havingspecified XData, MATLAB resets the x-axis ticks to 1:size(YData,1)or to the column indices of the ZData, overwriting anyprevious values for XData.

29.XDataSource

string (MATLAB variable)

LinkXData to MATLABvariable. Set this property to a MATLAB variable thatis evaluated in the base workspace to generate theXData.

MATLAB reevaluates this property only when you set it.Therefore, a change to workspace variables appearing in anexpression does not change XData.

You can use the refreshdata function to force an updateof the object's data. refreshdata also enables you tospecify that the data source variable be evaluated in the workspaceof a function from which you call refreshdata.

30.YDataSource

string (MATLAB variable)

LinkYData to MATLABvariable. Set this property to a MATLAB variable thatis evaluated in the base workspace to generate theYData.

MATLAB reevaluates this property only when you set it.Therefore, a change to workspace variables appearing in anexpression does not change YData.

You can use the refreshdata function to force an updateof the object's data. refreshdata also enables you tospecify that the data source variable be evaluated in the workspaceof a function from which you call refreshdata.

英文部分链接:http://www.mathworks.com/access/help desk/help/techdoc/ref/areaseriesproperties.html
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/plot.html

  

爱华网本文地址 » http://www.aihuau.com/a/25101016/307829.html

更多阅读

excel公式函数详解:19 yearfrac函数用法介绍

excel公式函数详解:[19]yearfrac函数用法介绍——简介一个良好的规划对于生活品质和工作效率都极其重要,在实际生活中我们往往需要计算一年有几个项目,每个项目需要花费多长时间。不同的工作其所花的中心也应该不一样。在excel中有一个

Excel函数详解:12 MONTH函数使用方法

Excel函数详解:[12]MONTH函数使用方法——简介MONTH函数,用于返回指定日期中的月份,返回月份的值范围是整数1(一月)~12(十二月)。Excel函数详解:[12]MONTH函数使用方法——工具/原料Excel for MacExcel函数详解:[12]MONTH函数使用方法——函

英语插入语用法详解 英语中名词的用法详解

插入语一般对一句话作一些附加的说明。它是中学英语语法的重点,也是高考的考点。掌握这一语言现象不仅有利于对句子、篇章的理解,而且也有助于提高书面表达的写作水平。一、常见的插入语有形容词(词组)、副词、不定式、现在分词短语

排列组合例题详解 概率论中的排列组合

1、“IMO”是国际数学奥林匹克的缩写,把这3个字母用3种不同颜色来写,现有5种不同颜色的笔,问共有多少钟不同的写法?分析:从5个元素中取3个的排列:P(5、3)=5×4×3=602、从数字0、1、2、3、4、5中任意挑选5个组成能被5除尽且各位数字互异的五

Matlab中使用Plot函数动态画图方法总结 matlab中plot画图

Matlab除了强大的矩阵运算,仿真分析外,绘图功能也是相当的强大,静态画图没什么问题,由于Matlab本身的多线程编程缺陷,想要动态的画图,并且能够很好的在GUI中得到控制,还不是一件很容易的事情,下面总结几种方法。一. AXIS 移动坐标系这种方法

声明:《Matlabplot函数详解 matlab中plot函数》为网友铁拳战士分享!如侵犯到您的合法权益请联系我们删除