تبلیغات
مهندسی مکانیک و هوافضا - Create Text Arrow Annotation
 
آخرین مطالب
 
پیوندهای روزانه
Create Text Arrow Annotation

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 ) ,
می توانید دیدگاه خود را بنویسید
canadian pharmacies online جمعه 2 فروردین 1398 03:23 ب.ظ
<a href="http://canadianonlinepharmacyoffer.com/">prescription drugs online without</a>
http://canadianonlinepharmacyoffer.com/
<a href=http://canadianonlinepharmacyoffer.com/>best 10 online pharmacies</a>
tbjhycle جمعه 2 فروردین 1398 01:19 ب.ظ
http://erectiledysfunctionmedicinesus.com/# - canadian online pharmacy generic viagra online <a href="http://erectiledysfunctionmedicinesus.com/#">cialis online pharmacy</a>
gdhengah جمعه 2 فروردین 1398 12:45 ب.ظ
http://bestbuymaleenhancement.com/# - where to buy cialis over the counter viagra pills <a href="http://bestbuymaleenhancement.com/#">canadian pharmacy online</a>
tadalafil جمعه 2 فروردین 1398 09:51 ق.ظ
what is tadalafil drug used for http://genericalis.com tadalafil requiere receta mexico
bsiRaine جمعه 2 فروردین 1398 07:47 ق.ظ
http://viagrapfhze.com/# - best place to buy cialis online reviews order viagra <a href="http://viagrapfhze.com/#">walmart pharmacy online</a>
buy sildenafil جمعه 2 فروردین 1398 05:18 ق.ظ
indicaciones de uso de sildenafil http://viagrabs.com/ viagra
viagra for sale جمعه 2 فروردین 1398 01:29 ق.ظ
sildenafil tablets over the counter viagra brand Name for sale
how to get free sildenafil samples
minecraft جمعه 2 فروردین 1398 01:17 ق.ظ
Excellent article. I am dealing with a few of these issues as well..
qazengah پنجشنبه 1 فروردین 1398 11:38 ب.ظ
http://cialisserfher.com/# - online pharmacy viagra tablets for sale <a href="http://cialisserfher.com/#">how to buy cialis</a>
bgfdrata پنجشنبه 1 فروردین 1398 09:16 ب.ظ
http://cialisovnnc.com/# - buying drugs from canada cialis 20 mg <a href="http://cialisovnnc.com/#">generic viagra review</a>
silagra sales پنجشنبه 1 فروردین 1398 04:18 ق.ظ
sildenafil for sale at boots
https://tadapox.wixsite.com/silagra buy online order silagra
cialis sildenafil was ist besser
tadapox on-line
difference between sildenafil professional and sildenafil super active
bsfGopay چهارشنبه 29 اسفند 1397 06:28 ب.ظ
http://canadiannowv.com/# - canada drugs coupon real viagra for sale <a href="http://canadiannowv.com/#">canadian pharmacy review</a>
online pharmacy canada چهارشنبه 29 اسفند 1397 05:10 ب.ظ
<a href="http://canadianonlinepharmacyneo.com/">online pharmacy no prescription</a>
http://canadianonlinepharmacyneo.com/
<a href=http://canadianonlinepharmacyneo.com/>canadian pharmacy</a>
tbfbiork چهارشنبه 29 اسفند 1397 04:57 ب.ظ
http://niqabsquad.com/# - viagra generic generic viagra sildenafil <a href="http://niqabsquad.com/#">canada online pharmacy</a>
bgjcinee چهارشنبه 29 اسفند 1397 12:55 ب.ظ
http://viagraoahvfn.com/# - best place to buy cialis viagra wholesale <a href="http://viagraoahvfn.com/#">generic viagra india</a>
http://cialisle.com چهارشنبه 29 اسفند 1397 08:52 ق.ظ
tadalafil solubility in acetone cialis online tadalafil analysis
canada drugs no prescription needed چهارشنبه 29 اسفند 1397 05:25 ق.ظ
<a href="http://canadianonlinepharmacyhd.com/">online drugstore</a>
http://canadianonlinepharmacyhd.com/
<a href=http://canadianonlinepharmacyhd.com/>top 10 mail order pharmacies</a>
online pharmacies چهارشنبه 29 اسفند 1397 04:55 ق.ظ
<a href="http://canadianonlinepharmacyhd.com/">rx online no prior prescription</a>
http://canadianonlinepharmacyhd.com/
<a href=http://canadianonlinepharmacyhd.com/>canadian pharmary without prescription</a>
gynswalm سه شنبه 28 اسفند 1397 05:02 ب.ظ
<a href=http://ketodietplanecyh.com/#>keto diet honey</a> what to eat on keto diet <a href="http://ketodietplanecyh.com/#">keto diet amazon</a>
cheap viagra canadian pharmacy سه شنبه 28 اسفند 1397 04:47 ب.ظ
order authentic viagra online cheap viagra online viagra best way to take.
online pharmacies canada سه شنبه 28 اسفند 1397 04:19 ب.ظ
<a href="http://canadianonlinepharmacycl.com/">top 10 mail order pharmacies</a>
http://canadianonlinepharmacycl.com/
<a href=http://canadianonlinepharmacycl.com/>best 10 online pharmacies</a>
mexican pharmacies shipping to usa سه شنبه 28 اسفند 1397 03:50 ب.ظ
<a href="http://canadianonlinepharmacycl.com/">rx online no prior prescription</a>
http://canadianonlinepharmacycl.com/
<a href=http://canadianonlinepharmacycl.com/>online pharmacies</a>
tgnhycle سه شنبه 28 اسفند 1397 08:28 ق.ظ
<a href="http://whatisketodiettuj.com/#">keto diet research</a> keto diet supplements <a href="http://whatisketodiettuj.com/#">what to eat before workout on keto diet</a>
thsengah سه شنبه 28 اسفند 1397 07:47 ق.ظ
<a href=http://ketodietrecipesxef.com/#>the keto diet</a> keto soup diet <a href="http://ketodietrecipesxef.com/#">what fruits can you eat on the keto diet</a>
viagra usa سه شنبه 28 اسفند 1397 04:36 ق.ظ
is there an expiry date for viagra [url=http://www.doctor7online.com/]viagra[/url] what is moroccan viagra
cheap cialis online سه شنبه 28 اسفند 1397 03:43 ق.ظ
[url=http://cialsonlinebei.com]canadian pharmacy cialis[/url] http://cialsonlinebei.com cheap cialis online
ikqRaine سه شنبه 28 اسفند 1397 02:53 ق.ظ
<a href="http://ketodietlistdfk.com/#">breakfast ideas for keto diet</a> vegetarian keto diet <a href="http://ketodietlistdfk.com/#">what to eat on a keto diet</a>
thnengah دوشنبه 27 اسفند 1397 06:33 ب.ظ
<a href=http://ketodietmenuwxr.com/#>keto diet nuts</a> keto diet rules <a href="http://ketodietmenuwxr.com/#">fast food on keto diet</a>
gbyAlkab دوشنبه 27 اسفند 1397 04:58 ب.ظ
http://cialiscials.com/# - buy cialis online overnight shipping viagra online <a href="http://cialiscials.com/#">canadian pharmacy cialis</a>
canadian pharcharmy online دوشنبه 27 اسفند 1397 04:11 ب.ظ
<a href="http://canadianhealthypharmacyrx.com/">no prescription pharmacy canada</a>
http://canadianhealthypharmacyrx.com/
<a href=http://canadianhealthypharmacyrx.com/>reputable mexican pharmacies online</a>
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر
نمایش نظرات 1 تا 30