تبلیغات
مهندسی مکانیک و هوافضا - Create Text Arrow Annotation
 
درباره وبلاگ


سایت تخصصی مهندسی مکانیک و هوافضا - جزوه - کتاب - مطالب آموزشی - نرم افزار - مقاله و ...

مدیر وبلاگ : حسین اتحادی
نویسندگان
صفحات جانبی
نظرسنجی
به وبلاگ ما چه امتیازی میدهید ؟







آمار وبلاگ
  • کل بازدید :
  • بازدید امروز :
  • بازدید دیروز :
  • بازدید این ماه :
  • بازدید ماه قبل :
  • تعداد نویسندگان :
  • تعداد کل پست ها :
  • آخرین بازدید :
  • آخرین بروز رسانی :
مهندسی مکانیک و هوافضا
هر آنچه که یک مهندس بخواهد اینجا هست!
صفحه نخست             تماس با مدیر           پست الکترونیک               RSS                  ATOM
پنجشنبه 4 شهریور 1395 :: نویسنده : حسین اتحادی

Create a simple line plot and add a text arrow to the figure. Specify the text arrow location in normalized figure coordinates, starting at the point (0.3,0.6) and ending at (0.5,0.5). Specify the text description by setting the String property.

figure
plot(1:10)
x = [0.3 0.5];
y = [0.6 0.5];
annotation('textarrow',x,y,'String','y = x ')

Create Text Box Annotation

Create a simple line plot and add a text box annotation to the figure. Specify the text description by setting the String property. Force the box to fit tightly around the text by setting the FitBoxToText property to 'on'.

figure
plot(1:10)
dim = [.2 .5 .3 .3];
str = 'Straight Line Plot from 1 to 10';
annotation('textbox',dim,'String',str,'FitBoxToText','on');

Create a text box annotation without setting the FitBoxToText property. The text box uses the specified width and height and wraps text as needed.

figure
plot(1:10)
dim = [.2 .5 .3 .3];
str = 'Straight Line Plot from 1 to 10';
annotation('textbox',dim,'String',str)

Create Text Box Annotation with Multiline Text

Create a text box annotation with multiline text by setting the String property to a cell array. Each element of the cell array displays on a separate line. Force the box to fit tightly around the text by setting theFitBoxToText property to 'on'.

figure
plot(1:10)
dim = [0.2 0.5 0.3 0.3];
str = {'Straight Line Plot','from 1 to 10'};
annotation('textbox',dim,'String',str,'FitBoxToText','on');

Create Rectangle Annotation

Create a stem plot and add a rectangle annotation to the figure. Change the color of the rectangle outline by specifying the Color property.

figure
data = [2 4 6 7 8 7 5 2];
stem(data)
dim = [.3 .68 .2 .2];
annotation('rectangle',dim,'Color','red')

Add a second rectangle annotation to the figure. Specify the fill color by setting the FaceColor property. Add transparency by setting the FaceAlpha property to a value between 0 (completely transparent) and 1 (completely opaque).

dim2 = [.74 .56 .1 .1];
annotation('rectangle',dim2,'FaceColor','blue','FaceAlpha',.2)

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.

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')

Combine Two Types of Annotations

Create a simple line plot. Then, add a bent arrow to the graph by combining a line and an arrow annotation.

figure
plot(1:10)

xl = [.3 .3];
yl = [.3 .4];
annotation('line',xl,yl)

xa = [.3 .4];
ya = [.4 .4];
annotation('arrow',xa,ya)

Modify Annotation After Creation

Add a text arrow to a figure and return the annotation text arrow object, a.

figure
plot(1:10)
x = [0.3,0.5];
y = [0.6,0.5];
a = annotation('textarrow',x,y,'String','y = x ');

Modify properties of the annotation text arrow using a. For example, change the color to red and the font size to 14 points.

a.Color = 'red';
a.FontSize = 14;

See the annotation property pages for a list of properties for each type of annotation.

Related Examples

Input Arguments

collapse all

lineType — Type of line annotation'line' | 'arrow' | 'doublearrow' | 'textarrow'

Type of line annotation, specified as one of these values.

ValueType of ObjectExample
'line'Annotation lineannotation('line',[.1 .2],[.1 .2])
'arrow'Annotation arrowannotation('arrow',[.1 .2],[.1 .2])
'doublearrow'Annotation double arrowannotation('doublearrow',[.1 .2],[.1 .2])
'textarrow'

Annotation text arrow. To add text to the tail end of the text arrow, use the String property.

annotation('textarrow',[.1 .2],[.1 .2],'String','my text')

shapeType — Type of shape annotation'rectangle' | 'ellipse' | 'textbox'

Type of shape annotation, specified as one of these values.

ValueType of ObjectExample
'rectangle'Annotation rectangleannotation('rectangle',[.2 .3 .4 .5])
'ellipse'Annotation ellipseannotation('ellipse',[.2 .3 .4 .5])
'textbox'

Annotation text box. To specify the text, set the String property. To automatically adjust the dimensions of the box to fit closely around the text, set the FitBoxToText property to 'on'.

annotation('textbox',[.2 .3 .4 .5],'String','my text','FitBoxToText','on')

x — Beginning and ending x-coordinatestwo-element vector of the form [x_begin x_end]

Beginning and ending x-coordinates, specified as a two-element vector of the form [x_begin x_end]. Together the x and y input arguments determine the endpoints of the line, arrow, double arrow, or text arrow annotation. The annotation extends from the point (x_beginy_begin) to (x_endy_end).

By default, the units are normalized to the figure. The lower left corner of the figure maps to (0,0) and the upper right corner maps to (1,1). To change the units, use the Units property.

Example: x = [.3 .5]

y — Beginning and ending y-coordinatestwo-element vector of the form [x_begin x_end]

Beginning and ending y-coordinates, specified as a two-element vector of the form [y_begin y_end]. Together the x and y input arguments determine the endpoints of the line, arrow, double arrow, or text arrow annotation. The annotation extends from the point (x_beginy_begin) to (x_endy_end).

By default, the units are normalized to the figure. The lower left corner of the figure maps to (0,0) and the upper right corner maps to (1,1). To change the units, use the Units property.

Example: y = [.3 .5]

dim — Size and locationfour-element vector of the form [x y w h]

Size and location, specified as a four-element vector of the form [x y w h]. The first two elements specify the coordinates of the lower left corner of the text box, rectangle, or ellipse with respect to the lower left corner of the figure. The second two elements specify the width and height of the annotation, respectively.

If you are creating an ellipse, then dim is the size and location of the smallest rectangle that encloses the ellipse.

By default, the units are normalized to the figure. The lower left corner of the figure maps to (0,0) and the upper right corner maps to (1,1). To change the units, use the Units property

Example: dim = [.3 .4 .5 .6]

container — Target for annotationfigure object | uipanel object | uitab object

Target for annotation, specified as a figure, uipanel, or uitab object. For example, to add an annotation to a specific figure, specify the figure object as the first input argument to the function.

f = figure;
annotation(f,'line',[.1 .2],[.2 .3])

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: annotation('rectangle',[.5 .5 .1 .1],'EdgeColor','r') creates a rectangle annotation with a red outline.

Each type of annotation object supports a different set of properties. For a full list of properties and descriptions for each type, see the associated property page.

Output Arguments

collapse all

a — Annotation objectscalar

Annotation object, returned as a scalar. The type of annotation object returned depends on the first input argument.

First Input ArgumentType of Object ReturnedProperty Page
'line'Annotation lineAnnotation Line Properties
'arrow'Annotation arrowAnnotation Arrow Properties
'doublearrow'Annotation double arrowAnnotation Double Arrow Properties
'textarrow'Annotation text arrowAnnotation Text Arrow Properties
'textbox'Annotation text boxAnnotation Text Box Properties
'rectangle'Annotation rectangleAnnotation Rectangle Properties
'ellipse'Annotation ellipseAnnotation Ellipse Properties

More About

collapse all

Compatibility Considerations

Starting in R2014b, annotations cannot cross uipanel boundaries. Instead, they clip at the boundaries. Previous versions of MATLAB® allow annotations to extend into (or out of) the boundaries. To display an annotation within a specific figure, uipanel, or uitab, use the container input argument.

See Also





نوع مطلب : متلب ( MATLAB )، 
برچسب ها :
لینک های مرتبط :


دوشنبه 16 مرداد 1396 03:08 ب.ظ
Hello, its pleasant paragraph concerning media print, we all understand media is
a great source of data.
دوشنبه 16 مرداد 1396 06:02 ق.ظ
Incredible! This blog looks exactly like my old
one! It's on a totally different topic but it has pretty much the
same page layout and design. Superb choice of colors!
شنبه 14 مرداد 1396 01:27 ق.ظ
Everything is very open with a really clear clarification of
the issues. It was really informative. Your website is very useful.
Many thanks for sharing!
شنبه 7 مرداد 1396 03:01 ب.ظ
I believe everything posted made a ton of sense. However, what about this?

suppose you added a little information? I ain't suggesting your
information is not good., however what if you added a post title that grabbed people's attention? I mean مهندسی
مکانیک و هوافضا - Create Text Arrow Annotation is kinda
plain. You should look at Yahoo's home page and see how they create news titles to grab people interested.
You might try adding a video or a pic or two to grab
readers interested about everything've got to say.
Just my opinion, it might bring your posts a little livelier.
جمعه 6 مرداد 1396 08:38 ب.ظ
Thank you, I've recently been searching for information approximately
this topic for a long time and yours is the best I've discovered so far.
However, what in regards to the bottom line? Are
you positive concerning the source?
جمعه 30 تیر 1396 09:14 ق.ظ
What's up to all, how is everything, I think every one
is getting more from this site, and your views are fastidious in favor of new people.
شنبه 24 تیر 1396 07:45 ب.ظ
My brother recommended I might like this web site. He was totally right.
This post actually made my day. You can not imagine just how much time I
had spent for this information! Thanks!
دوشنبه 12 تیر 1396 08:41 ق.ظ
Wonderful blog! I found it while surfing around on Yahoo News.
Do you have any tips on how to get listed in Yahoo News?

I've been trying for a while but I never seem to get there!
Thank you
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر


 
 
برچسب ها
پیوندها
آخرین مطالب