科学计算科学计算 (45).pdf
《科学计算科学计算 (45).pdf》由会员分享,可在线阅读,更多相关《科学计算科学计算 (45).pdf(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、ChapterChapter 8 8 MATLABMATLAB GraphicalGraphical UserUserInterfaceInterface DesignDesign8.1 Figure and Axes8.2 Line and Surface8.3 Ways to Develop Apps8.4 App Development Using GUIDE8.5 App Development Using App Designer8.6 Examples of App DevelopmentHandleHandle ofof a a GraphicsGraphics ObjectOb
2、jectGraphicsGraphics ObjectObject PropertiesPropertiesF Figureigure ManipulationManipulationAxesAxes ManipulationManipulation8.1 Figure and Axes8.1 Figure and Axes1.Handle of a Graphics Object1.Handle of a Graphics Object(1)Whats a handle?A graph in MATLAB is composed of several specific graphics ob
3、jects.A handle is used to identify an object,and to access the properties of the object.Example 1:Create several plots and save their handles.t=0:pi/10:2*pi;h1=plot3(t+pi,t-2*pi,sin(t),r);hold on;x,y=meshgrid(t);z=sin(x);h2=mesh(t-2*pi,t+pi,z);x3,y3,z3=cylinder(t);h3=surf(x3,y3,z3);1.Handle of a Gra
4、phics Object1.Handle of a Graphics Object(2)Access graphics objectsAccessing graphics objects refers to getting or setting the properties of graphics objects.Different graphics objects have different properties,but methods accessed are the same.Object.PropertyName x=0:pi/10:2*pi;y=sin(x);h0=plot(x,y
5、);h0.Colorans=0 0.4470 0.7410 h0.LineWidth=2;h0.LineStyle=-.;1.Handle of a Graphics Object1.Handle of a Graphics Object(3)Get handles of specific graphics objectsgcf:get the handle of the current figure window.gca:get the handle of the current axes.gco:get the handle of the last object selected.find
6、obj:locate graphics objects based on the value ofthe specific property.1.Handle of a Graphics Object1.Handle of a Graphics Object2.Graphics 2.Graphics Object PropertiesObject Properties(1)Common properties of graphics objectsChildren:An array composed of the handles of all child objects.Parent:Handl
7、e of the parent container.Type:Type of an object.It is read-only.Tag:Identifier of an object.subplot(1,2,1)h1=fplot(t)t.*sin(t),(t)t.*cos(t),0,6*pi);axis equalsubplot(1,2,2)x,y,z=peaks(20);h2=mesh(x,y,z);h10=h1.Parent;h10.Color=y;h1.Color=r;h2.Parent.Color=cyan;2.Graphics 2.Graphics Object Propertie
8、sObject PropertiesExample 2:Create a line and a surface in two subplots respectively.Set the background colorof subplot 1 to yellow and the line color to red.Set the background color of subplot 2 to cyan.2.Graphics 2.Graphics Object PropertiesObject Properties(2)Dynamic properties of graphics object
9、sKeyPressFcn:in response to a keypress event.CreateFcn:responds when a graphics object is created.DeleteFcn:responds when a graphics object is deleted.WindowButtonDownFcn:in response to a click event.ButtonDownFcn:in response to a click event3 3.Figure Manipulation.Figure Manipulation(1)Create figur
10、e objectMATLAB creates figure objects through the figure function.Syntax:handle=figure(property1,value1,property2,value 2,)Properties are used to set the appearance of a figure window.handle=figureCreate the figure window using default property values.figure(handle)Make the figure corresponding to t
11、his handle the current window.3 3.Figure Manipulation.Figure Manipulation(2)Properties of figureMenuBar:Display or hide the default menus.The value is none or figureName:The name of a figure.NumberTitle:Whether the title of the figure includes the phrase Figure n.Color:Background color of a figure.3
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 科学计算科学计算 45 科学 计算 45
限制150内