logging in or signing up lecture20 FunnyGuy Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 190 Category: Entertainment License: All Rights Reserved Like it (1) Dislike it (0) Added: December 28, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Section 13.2Handle Graphics: Section 13.2 Handle Graphics A handle is a “nickname” given to an object in MATLAB We can assign a handle to Individual plots The figure window The axis on which we draw the plotsSlide2: “Tree” structure Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects MATLAB uses a hierarchical system for organizing plotting information Slide3: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The basic plotting object is the figure. The figure can contain a number of different objectsSlide4: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The basic plotting object is the figure. The figure can contain a number of different objectsSlide5: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The axes are contained inside the figure. Think of the axes as being layered on top of the figure window . The axes also can contain a number of different objects .Slide6: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The axes are contained inside the figure. Think of the axes as being layered on top of the figure window . The axes also can contain a number of different objects .Slide7: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects A plot is drawn on top of the axes. Anatomy of a graph: Anatomy of a graph Figure Axes layered on top of the figure Plot drawn on the axesWhen you use a plot function…: When you use a plot function… MATLAB automatically creates a figure an appropriate axis draws the graph (plot) on the axis MATLAB uses default values for many of the plot object properties. For example the first line drawn is always blue, unless the user specifically changes it.How to Change Default Actions: How to Change Default Actions some defaults can be modified with the plot() function >> xVals=linspace(0,pi,100); >> yVals=exp(sin(xVals)); compare >> plot(xVals, yVals); with >> plot(xVals, yVals,’r’);Handles Allow us to Change (nearly) anything about the plot: Handles Allow us to Change (nearly) anything about the plot font & size of title font & size of labels style of tick-marks figure heading Slide12: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects Each of these has a handle figure handle axes handle plot handleFigure Handles: Figure Handles We can specify a handle name for the figure window Using the figure handle, we can change the figure title, background color, etc Slide14: A figure window has a lot of propertiesSlide15: If we haven’t specified a handle name, we can ask MATLAB to determine the current figure with the gcf command (get current figure) get(f_handle) and get(gcf) return the same results in this exampletry these commands: try these commands gCounts = [10 9 8 7 2] pie(gCounts, {'A' 'B' 'C' 'D' 'F'}) get(gcf) set(gcf,'Color','red') set(gcf,'Color', [1 0 1]) add a name to your figure set(gcf,’name’,…)generate a plot to work with using the plot() command: generate a plot to work with using the plot() command xVals=linspace(0,pi,100); yVals=exp(sin(xVals)); plot(xVals, yVals); look at the parent & children of the figure get(gcf) get(gcf,'children')Axis Handles: Axis Handles Just as we can assign a handle to the figure window and the plot itself, we can assign a handle to the axis using the gca function (get current axis ) for example h_axis = gcaSlide19: h_axis is the name of the axis upon which the plot is drawn in this exampleAnnotation Axes: Annotation Axes In addition there is a transparent layer added to the plot, used for annotation objects, such as: lines legends text boxesPlot Handles: Plot Handles Assigning a plot a name (or a handle) allows us to easily ask MATLAB to list the plot object properties Slide22: h is the plot handleSlide23: The get function returns a list of the object (in this case a plot) propertiessummary: summary get() -- obtain information about a handle-graphics object set() -- change something about a handle-graphics object parent and children show the tree-structure of objects Exercise: Exercise plot sin(x) for x= 0 to 3 pi Use bold fonts for the title and axis Increase the size of the font for the title by 2 points Slide27: handle graphics Modify fonts for titles & labels set() discovers all the options for setting things about the axis get(handle) obtains the current settings gca is the handle of the current axes gcf is the handle of the current figure tree structure (gca is a child of gcf, the plot is a child of gca). Slide28: Preditor-Prey Population Modeling Competition/cooperation between a preditor and prey Lotka-Volterra model Matrix Model Implementation Slide29: Variables Slide30: Lotka-Volterra Equation Slide31: Approximate the solution to the LV model using Matlab Slide32: Include a phase diagram Slide33: Hint Instead of letting ode45() generate the plot, capture the solution and plot it yourself [Tvec critterVec] = ode45(@lvRHS, tVals, critters0); Cvec = critterVec(:,1); Pvec = critterVec(:,2); plot(Cvec,Pvec) Slide34: Connection with handle graphices Change the line thickness of the graphs generated automatically by ode45 Use bold (and larger) fonts for the title. Use bold fonts for the legends and labels. You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
lecture20 FunnyGuy Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 190 Category: Entertainment License: All Rights Reserved Like it (1) Dislike it (0) Added: December 28, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Section 13.2Handle Graphics: Section 13.2 Handle Graphics A handle is a “nickname” given to an object in MATLAB We can assign a handle to Individual plots The figure window The axis on which we draw the plotsSlide2: “Tree” structure Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects MATLAB uses a hierarchical system for organizing plotting information Slide3: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The basic plotting object is the figure. The figure can contain a number of different objectsSlide4: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The basic plotting object is the figure. The figure can contain a number of different objectsSlide5: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The axes are contained inside the figure. Think of the axes as being layered on top of the figure window . The axes also can contain a number of different objects .Slide6: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The axes are contained inside the figure. Think of the axes as being layered on top of the figure window . The axes also can contain a number of different objects .Slide7: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects A plot is drawn on top of the axes. Anatomy of a graph: Anatomy of a graph Figure Axes layered on top of the figure Plot drawn on the axesWhen you use a plot function…: When you use a plot function… MATLAB automatically creates a figure an appropriate axis draws the graph (plot) on the axis MATLAB uses default values for many of the plot object properties. For example the first line drawn is always blue, unless the user specifically changes it.How to Change Default Actions: How to Change Default Actions some defaults can be modified with the plot() function >> xVals=linspace(0,pi,100); >> yVals=exp(sin(xVals)); compare >> plot(xVals, yVals); with >> plot(xVals, yVals,’r’);Handles Allow us to Change (nearly) anything about the plot: Handles Allow us to Change (nearly) anything about the plot font & size of title font & size of labels style of tick-marks figure heading Slide12: Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects Each of these has a handle figure handle axes handle plot handleFigure Handles: Figure Handles We can specify a handle name for the figure window Using the figure handle, we can change the figure title, background color, etc Slide14: A figure window has a lot of propertiesSlide15: If we haven’t specified a handle name, we can ask MATLAB to determine the current figure with the gcf command (get current figure) get(f_handle) and get(gcf) return the same results in this exampletry these commands: try these commands gCounts = [10 9 8 7 2] pie(gCounts, {'A' 'B' 'C' 'D' 'F'}) get(gcf) set(gcf,'Color','red') set(gcf,'Color', [1 0 1]) add a name to your figure set(gcf,’name’,…)generate a plot to work with using the plot() command: generate a plot to work with using the plot() command xVals=linspace(0,pi,100); yVals=exp(sin(xVals)); plot(xVals, yVals); look at the parent & children of the figure get(gcf) get(gcf,'children')Axis Handles: Axis Handles Just as we can assign a handle to the figure window and the plot itself, we can assign a handle to the axis using the gca function (get current axis ) for example h_axis = gcaSlide19: h_axis is the name of the axis upon which the plot is drawn in this exampleAnnotation Axes: Annotation Axes In addition there is a transparent layer added to the plot, used for annotation objects, such as: lines legends text boxesPlot Handles: Plot Handles Assigning a plot a name (or a handle) allows us to easily ask MATLAB to list the plot object properties Slide22: h is the plot handleSlide23: The get function returns a list of the object (in this case a plot) propertiessummary: summary get() -- obtain information about a handle-graphics object set() -- change something about a handle-graphics object parent and children show the tree-structure of objects Exercise: Exercise plot sin(x) for x= 0 to 3 pi Use bold fonts for the title and axis Increase the size of the font for the title by 2 points Slide27: handle graphics Modify fonts for titles & labels set() discovers all the options for setting things about the axis get(handle) obtains the current settings gca is the handle of the current axes gcf is the handle of the current figure tree structure (gca is a child of gcf, the plot is a child of gca). Slide28: Preditor-Prey Population Modeling Competition/cooperation between a preditor and prey Lotka-Volterra model Matrix Model Implementation Slide29: Variables Slide30: Lotka-Volterra Equation Slide31: Approximate the solution to the LV model using Matlab Slide32: Include a phase diagram Slide33: Hint Instead of letting ode45() generate the plot, capture the solution and plot it yourself [Tvec critterVec] = ode45(@lvRHS, tVals, critters0); Cvec = critterVec(:,1); Pvec = critterVec(:,2); plot(Cvec,Pvec) Slide34: Connection with handle graphices Change the line thickness of the graphs generated automatically by ode45 Use bold (and larger) fonts for the title. Use bold fonts for the legends and labels.