www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/CreateEllipseAnnotationExample.m

    %% Create Ellipse Annotation
% Create a simple line plot and add an ellipse annotation to the figure.
% Specify |dim| as the size and location of the smallest rectangle that
% encloses the ellipse. 

% Copyright 2015 The MathWorks, Inc.


figure
x = linspace(-4,4);
y = x.^3 - 12*x;
plot(x,y)

dim = [.2 .74 .25 .15];
annotation('ellipse',dim)


%%
% Draw a red rectangle using the same dimensions to show how the ellipse
% fills the rectanglular area.
annotation('rectangle',dim,'Color','red')