Matlab textbox

How can I create a text box alongside my plot?

One way to do this is to use "<https://www.mathworks.com/help/matlab/ref/annotation.html annotation>" command. The bare-bones syntax for this is as follows:

annotation('textbox', [0.5, 0.2, 0.1, 0.1], 'String', "hi")

This places a text box with horizontal offset of 50% of the Figure's width, and vertical offset of 20% of the Figure's height. The size of the box is 10% of Figure's height by 10% of Figure's width:

To place a textboxoutside the plot, you can modify the position and/or dimensions of the axis. For example:

figure;

plot(1:10);

a = gca;

a.Position(3) = 0.6;

annotation('textbox', [0.75, 0.1, 0.1, 0.1], 'String', "pi value is " + pi)

This will produce the following figure:

Sours: https://www.mathworks.com/matlabcentral/answers/385245-how-can-i-create-a-text-box-alongside-my-plot

TextBox Properties

Main Content

properties control the appearance and behavior of a object. By changing property values, you can modify certain aspects of the text box. Use dot notation to query and set properties.

t = annotation('textbox'); sz = t.FontSize; t.FontSize = 12;

Text

expand all

— Text to display
(default) | character vector | cell array of character vectors | string array | categorical array | numeric value

Text to display, specified as a character vector, cell array of character vectors, string array, categorical array, or numeric value. Specify a value according to how you want the text to appear. This table lists the most common situations.

Appearance of TextDescription of ValueExample
One line of text Character vector or 1-by-1 string array.or
Multiple lines of textCell array of character vectors or a string array.
str = {'First line','Second line'};
or
str = ["First line", "Second line"];
Text that includes a numeric variableArray that includes the number converted to a array. Use to convert the value.
x = 42; str = ['The value is ',num2str(x)];
Text that includes special characters such as Greek letters or mathematical symbolsArray that includes TeX markup. For a list of supported markup, see the property.
str = 'x ranges from 0 to 2\pi'

Note

  • The words , , and are reserved words that do not appear in text when quoted as normal characters. To display any of these words individually, precede them with a backslash, such as or .

  • If you specify this property as a categorical array, MATLAB® uses the values in the array, not the categories.

  • If you specify text that contains only a numeric value, the value is converted using . For example, displays as .

— Text color
(default) | RGB triplet | hexadecimal color code | | | | ...

Text color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short name. The default value of corresponds to black.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range ; for example, .

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol () followed by three or six hexadecimal digits, which can range from to . The values are not case sensitive. Thus, the color codes , , , and are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color NameShort NameRGB TripletHexadecimal Color CodeAppearance
Not applicableNot applicableNot applicableNo color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

RGB TripletHexadecimal Color CodeAppearance

Example:

Example:

Example:

— Text interpreter
(default) | |

Text interpreter, specified as one of these values:

  • — Interpret characters using a subset of TeX markup.

  • — Interpret characters using LaTeX markup.

  • — Display literal characters.

TeX Markup

By default, MATLAB supports a subset of TeX markup. Use TeX markup to add superscripts and subscripts, modify the font type and color, and include special characters in the text.

Modifiers remain in effect until the end of the text. Superscripts and subscripts are an exception because they modify only the next character or the characters within the curly braces. When you set the interpreter to , the supported modifiers are as follows.

ModifierDescriptionExample
Superscript
Subscript
Bold font
Italic font
Oblique font (usually the same as italic font)
Normal font
Font name — Replace with the name of a font family. You can use this in combination with other modifiers.
Font size —Replace with a numeric scalar value in point units.
Font color — Replace with one of these colors: , , , , , , , , , , or .
Custom font color — Replace with a three-element RGB triplet.

This table lists the supported special characters for the interpreter.

Character SequenceSymbolCharacter SequenceSymbolCharacter SequenceSymbol

α

υ

~

χ

β

ψ

γ

ω

δ

Γ

ϵ

Δ

ζ

Θ

η

Λ

θ

Ξ

ϑ

Π

ι

Σ

κ

ϒ

λ

Φ

µ

Ψ

º

ν

Ω

±

ξ

π

ρ

σ

ς

÷

τ

·

ο

¬

x

...

´

ϖ

|

©

LaTeX Markup

To use LaTeX markup, set the interpreter to . For inline mode, surround the markup with single dollar signs (). For display mode, surround the markup with double dollar signs ().

LaTeX ModeExampleResult
Inline
Display

The displayed text uses the default LaTeX font style. The , , and properties do not have an effect. To change the font style, use LaTeX markup.

The maximum size of the text that you can use with the LaTeX interpreter is 1200 characters. For multiline text, this reduces by about 10 characters per line.

For examples that use TeX and LaTeX, see Greek Letters and Special Characters in Chart Text. For more information about the LaTeX system, see The LaTeX Project website at https://www.latex-project.org/.

Font

expand all

— Font name
supported font name |

Font name, specified as a supported font name or . To display and print text properly, you must choose a font that your system supports. The default font depends on your operating system and locale.

To use a fixed-width font that looks good in any locale, use . The fixed-width font relies on the root property. Setting the root property causes an immediate update of the display to use the new font.

— Font size
scalar value greater than 0

Font size, specified as a scalar value greater than 0 in point units. The default font size depends on the specific operating system and locale. One point equals 1/72 inch. To change the font units, use the property.

Example:

Data Types: | | | | | | | | | |

— Character thickness
(default) |

Character thickness, specified as or .

MATLAB uses the property to select a font from those available on your system. Not all fonts have a bold weight. Therefore, specifying a bold font weight can still result in the normal font weight.

— Character slant
(default) |

Character slant, specified as or .

Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.

— Font size units
(default) | | | |

Font size units, specified as one of the values in this table.

Description
Points. One point equals 1/72 inch.
Inches.
Centimeters.
Interpret font size as a fraction of the parent container height, typically a figure. If you resize the container, the font size modifies accordingly. For example, if the is in normalized units, then the text is 1/10 of the container height.

Pixels.

Starting in R2015b, distances in pixels are independent of your system resolution on Windows® and Macintosh systems:

  • On Windows systems, a pixel is 1/96th of an inch.

  • On Macintosh systems, a pixel is 1/72nd of an inch.

On Linux® systems, the size of a pixel is determined by your system resolution.

If you set both the font size and the font units in one function call, you must set the property first so that the axes correctly interprets the specified font size.

Text Box

expand all

— Option to fit box width and height to text
(default) | on/off logical value

Option to fit the box width and height to the text, specified as or , or as numeric or logical () or (). A value of is equivalent to , and is equivalent to . Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type .

  • — Resize the text box to fit the text.

  • — Wrap the text to fit the width of the text box. Wrapping can cause some of the text to extend below the text box.

If you resize a text box when in plot edit mode, or if you change the property, then the property changes to .

— Color of box outline
(default) | RGB triplet | hexadecimal color code | | | | ...

Color of box outline, specified as a three-element RGB triplet, a hexadecimal color code, a color name, or a short name. The default value of corresponds to black.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range ; for example, .

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol () followed by three or six hexadecimal digits, which can range from to . The values are not case sensitive. Thus, the color codes , , , and are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color NameShort NameRGB TripletHexadecimal Color CodeAppearance
Not applicableNot applicableNot applicableNo color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

RGB TripletHexadecimal Color CodeAppearance

Example:

Example:

Example:

— Color of text box background
(default) | RGB triplet | hexadecimal color code | | | | ...

Color of text box background, specified as an RGB triplet, a hexadecimal color code, a color name, or a short name.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range ; for example, .

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol () followed by three or six hexadecimal digits, which can range from to . The values are not case sensitive. Thus, the color codes , , , and are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color NameShort NameRGB TripletHexadecimal Color CodeAppearance
Not applicableNot applicableNot applicableNo color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

RGB TripletHexadecimal Color CodeAppearance

Example:

Example:

Example:

— Transparency of background color
(default) | scalar value between 0 and 1 inclusive

Transparency of the background color, specified as a scalar value between 0 and 1. If the value is 1, then the color is opaque. To add transparency, set the property to a value closer to 0, where 0 is completely transparent.

— Line style of box outline
(default) | | | |

Line style of box outline, specified as one of the options listed in this table.

Line StyleDescription
Solid line
Dashed line
Dotted line
Dash-dotted line
Box outline is invisible

— Width of box outline
(default) | scalar numeric value

Width of box outline, specified as a scalar numeric value in point units. One point equals 1/72 inch.

Example:

Data Types: | | | | | | | | |

— Space around text within the text box
(default) | scalar numeric value

The space around the text within the text box, specified as a scalar numeric value in pixel units.

Data Types: | | | | | | | | | |

Position

expand all

— Size and location
(default) | four-element vector

Size and location, specified as a four-element vector of the form . The first two elements specify the coordinates for the lower-left corner of the text box. The second two elements specify the length and height of the text box.

By default, the units are normalized to the figure. The lower-left corner of the figure maps to , and the upper-right corner maps to . To change the units, use the property.

Note

If the property is set to and you change the property, then the property might not reflect the latest changes until the next time the screen refreshes. To ensure that the position value reflects the latest changes, call before querying the position when working in a script or function.

Example:

— Position units
(default) | | | | |

Position units, specified as one of the values in this table.

Description
(default)Normalized with respect to the figure, uipanel, or uitab that contains the annotation. The lower-left corner of the container maps to and the upper-right corner maps to .
Inches.
Centimeters.

Based on the default system font character size.

  • Character width = width of letter .

  • Character height = distance between the baselines of two lines of text.

Points. One point equals 1/72 inch.

Pixels.

Starting in R2015b, distances in pixels are independent of your system resolution on Windows and Macintosh systems:

  • On Windows systems, a pixel is 1/96th of an inch.

  • On Macintosh systems, a pixel is 1/72nd of an inch.

On Linux systems, the size of a pixel is determined by your system resolution.

All units are measured from the lower-left corner of the figure window.

This property affects the property. If you change the units, then it is good practice to return it to the default value after completing your computation to prevent affecting other functions that assume is set to the default value.

If you specify the and properties as pairs when creating the object, then the order of specification matters. If you want to define the position with particular units, then you must set the property before the property.

— Horizontal alignment of text within text box
(default) | |

Horizontal alignment of the text within the text box, specified as one of the values in this table.

ValueResult

— Vertical alignment of text within text box
(default) | |

Vertical alignment of the text within the text box, specified as one of the values in this table.

ValueResult

Note

The and values are not recommended. Use the and values, respectively, instead.

Introduced before R2006a

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web site

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Contact your local office

Sours: https://www.mathworks.com/help/matlab/ref/matlab.graphics.shape.textbox-properties.html
  1. Split ring float
  2. Frog speaking chinese meme
  3. Hitch pins amazon

Text Box in MATLAB

Created: May-07, 2021

  1. Add a Text Box on a Plot Using the Function in MATLAB
  2. Add a Text Box on a Plot Using the Function in MATLAB

This tutorial will discuss how to add a text box on a plot using the and function in MATLAB.

Add a Text Box on a Plot Using the Function in MATLAB

To add a text box with some text on a plot in MATLAB, you can use the function. The function creates a text box with given dimensions on the plot and adds given text to the text box. To add the given text to the text box, we have to use the property inside the function. We can also use the to add fit the box to the given text. For example, let’s plot a sine wave and add a text box with some text in it. See the code below.

Output:

Text Box using the annotation() function in matlab

In the above code, you can change the text and dimensions of the text box according to your requirements. You can also change the name of the font using the property, the size of the font using the property, the color of the text using the property, the background color of the text box using the property, and the color of the box using the property. For example, let’s change all these properties of the text box using a function handle. See the code below.

Output:

Setting different properties of the text box in matlab

In the above code, the function handle will display all the properties of the text box on the command window, which we can change using the function handle . Check this link for more details about the function.

Add a Text Box on a Plot Using the Function in MATLAB

You can also use the function to add text with a box to the plot. You need to pass the x and y coordinate on which you want to place the text. Simply plot the variable and then select the coordinates from the plot and then use the function to place the text on the selected coordinates. If you give the coordinates which don’t lie on the plot, you can’t see the text. You can also change the properties of the text like the font size using the property and the color using the property etc. For example, let’s plot a cosine wave and put some text on it with font size 18 and red color and a black box around the text. See the code below.

Output:

Text Box using the text() function in matlab

You can give your desired color to the text using the property and the box using the property. You can also add multiple texts at multiple positions on the plot with different text, line styles, color, size, and box. Check this link for more details about the function.

Contribute

DelftStack is a collective effort contributed by software geeks like you. If you like the article and would like to contribute to DelftStack by writing paid articles, you can check the write for us page.

Related Article - MATLAB Plot

  • MATLAB Animated Plot
  • MATLAB Ramp Input Response
  • Sours: https://www.delftstack.com/howto/matlab/textbox-matlab/

    annotation

    Main Content

    Description

    example

    creates a line or arrow annotation extending between two points in the current figure. Specify as , , , or . Specify and as two-element vectors of the form and , respectively.

    creates the annotation in the default position between the points and .

    example

    creates a rectangle, ellipse, or text box annotation with a particular size and location in the current figure. Specify as , , or . Specify as a four-element vector of the form . The and elements determine the position and the and elements determine the size.

    creates the annotation in the default position so that the lower left corner is at and the width and height are both .

    example

    creates the annotation and specifies properties as name-value pair arguments. Different types of annotations support different properties. You can specify properties with any of the input argument combinations in the previous syntaxes.

    creates the annotation in the figure, uipanel, or uitab specified by , instead of in the current figure.

    example

    returns the annotation object. The type of object returned depends on first input argument. Use to modify properties of the object after it is created. You can specify an output argument with any of the previous syntaxes.

    Examples

    collapse all

    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 and ending at . Specify the text description by setting the 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 property. Force the box to fit tightly around the text by setting the property to .

    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 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 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 the property to .

    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 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 property. Add transparency by setting the 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 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 rectangular 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, .

    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 . 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.

    Input Arguments

    collapse all

    — Type of line annotation
    | | |

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

    ValueType of ObjectExample
    Annotation line
    Annotation arrow
    Annotation double arrow

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

    — Type of shape annotation
    | |

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

    ValueType of ObjectExample
    Annotation rectangle
    Annotation ellipse

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

    — Beginning and ending x-coordinates
    two-element vector of the form

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

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

    Example:

    — Beginning and ending y-coordinates
    two-element vector of the form

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

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

    Example:

    — Size and location
    four-element vector of the form

    Size and location, specified as a four-element vector of the form . 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 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 and the upper right corner maps to . To change the units, use the property

    Example:

    — Target for annotation
    figure 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 Arguments

    Specify optional comma-separated pairs of arguments. is the argument name and is the corresponding value. must appear inside quotes. You can specify several name and value pair arguments in any order as .

    Example: 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

    — Annotation object
    scalar

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

    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 input argument.

    See Also

    Functions

    Properties

    Introduced before R2006a

    You have a modified version of this example. Do you want to open this example with your edits?

    You clicked a link that corresponds to this MATLAB command:

    Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

    Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

    Select web site

    You can also select a web site from the following list:

    How to Get Best Site Performance

    Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

    Contact your local office

    Sours: https://www.mathworks.com/help/matlab/ref/annotation.html

    Textbox matlab

    mlreportgen.ppt.TextBox class

    Main Content

    Package: mlreportgen.ppt
    Superclasses:

    Description

    Text box to include in a presentation.

    Construction

    creates an empty text box object.

    Output Arguments

    expand all

    — Text box
    object

    Text box, returned as an object.

    Properties

    expand all

    — Option to use bold for text
    logical value

    Option to use bold for text, specified as or . To make text bold, set this property to

    — Font color for presentation element
    character vector

    Font color, specified as a character vector. Use either a CSS color name or a hexadecimal RGB value.

    • For a list of CSS color names, see https://www.crockford.com/wrrrld/color.html.

    • To specify a hexadecimal RGB format, use as the first character and two-digit hexadecimal numbers for each for the red, green, and blue values. For example, specifies blue.

    — Option to use italics for text
    (default) | logical value

    Option to use italics for text, specified as a logical. Set this property to . Setting the property adds a corresponding format object to the property of this presentation element. Removing the property setting removes the object.

    Data Types:

    — Type of underline for text
    (default) | character vector

    Type of underlining for text, specified as a character vector. Setting the property adds a corresponding format object to the property for this element. Removing the property setting removes the object. You can specify one of these types of underlines.

    ValueDescription
    Single underline
    Double underline
    Thick underline
    Words only underlined (not spaces)
    Dotted underline
    Thick, dotted underline
    Dashed underline
    Thick, dashed underline
    Long, dashed underline
    Thick, long, dashed underline
    Dot dash underline
    Dot dot dash underline
    Thick dot dot dash underline
    Thick dash dot underline
    Wavy underline
    Thick wavy underline
    Two wavy underlines

    — Text box name
    character vector

    Text box name, specified as a character vector.

    — Upper-left x-coordinate position of text box
    character vector

    Upper-left x-coordinate of text box, specified in the form where is an abbreviation for the units. Valid abbreviations are:

    • — pixels (default)

    • — centimeters

    • — inches

    • — millimeters

    • — picas

    • — points

    — Upper-left y-coordinate position of text box
    character vector

    Upper-left y-coordinate position of text box, specified in the form where is an abbreviation for the units. Valid abbreviations are:

    • — pixels (default)

    • — centimeters

    • — inches

    • — millimeters

    • — picas

    • — points

    — Width of text box
    character vector

    Width of text box, specified in the form where is an abbreviation for the units. Valid abbreviations are:

    • — pixels (default)

    • — centimeters

    • — inches

    • — millimeters

    • — picas

    • — points

    — Height of text box
    character vector

    Height of text box, specified in the form where is an abbreviation for the units. Valid abbreviations are:

    • — pixels (default)

    • — centimeters

    • — inches

    • — millimeters

    • — picas

    • — points

    — Text formatting
    cell array of PPT format objects

    Text formatting, specified as a cell array of PPT format objects. You can specify these format objects:

    • object

    • object

    • object

    • object

    • object

    • object

    • object

    — Children of this PPT API object
    cell array of PPT objects

    Child elements of this object, specified as a cell array of PPT objects. This property is read-only.

    — Parent of this PPT API object
    PPT object

    Parent of this object, specified as a PPT object. This property is read-only.

    — Tag for this PPT API object
    character vector | string scalar

    Tag for this PPT API object, specified as a character vector or string scalar. A session-unique tag is generated as part of the creation of this object. The generated tag has the form , where is the object class and is the value of the property of the object.

    Specifying your own tag value can help you to identify where an issue occurred during presentation generation.

    — ID for this PPT API object
    character vector | string scalar

    ID for this PPT API object, specified as a character vector or string scalar. A session-unique ID is generated as part of object creation. You can specify an ID to replace the generated ID.

    Methods

    Method

    Purpose

    Add paragraph to text box

    Replace text box paragraphs

    returns a copy of the object specified by .

    Use the method of a object the same way that you use the method of a object.

    Examples

    collapse all

    Add a Text Box

    Create a presentation with two slides.

    import mlreportgen.ppt.* ppt = Presentation('myTextBoxPresentation.pptx');

    Add a blank slide.

    blank = add(ppt,'Blank');

    Create a text box and define its location and size.

    tb = TextBox(); tb.X = '1in'; tb.Y = '1in'; tb.Width = '8in'; tb.Height = '0.5in';

    Add text to the text box and append the text box to the blank slide.

    add(tb,'This is the title of my blank slide'); add(blank,tb);

    Close and view the presentation.

    close(ppt); rptview(ppt);

    Here is the generated presentation:

    You clicked a link that corresponds to this MATLAB command:

    Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

    Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

    Select web site

    You can also select a web site from the following list:

    How to Get Best Site Performance

    Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

    Contact your local office

    Sours: https://www.mathworks.com/help/rptgen/ug/mlreportgen.ppt.textbox-class.html
    MATLAB Function ReferencePrevious page   Next Page
    Annotation Textbox Properties
    Modifying Properties

    You can set and query annotation object properties using the and functions and the Property Editor (displayed with the command).

    Use the function to create annotation objects and obtain their handles.

    Annotation Textbox Property Descriptions

    Properties You Can Modify

    This section lists the properties you can modify on an annotation ellipse object.

    ColorSpec Default:

    Color of textbox background. A three-element RGB vector or one of the MATLAB predefined names, specifying the background color of the textbox. A value of makes the textbox transparent, enabling objects behind the textbox to be visible.

    ColorSpec Default: [0 0 0]

    Color of the text. A three-element RGB vector or one of the MATLAB predefined names, specifying the arrow color.

    See the reference page for more information on specifying color.

    ColorSpec Default: [0 0 0]

    Color of the textbox edge. A three-element RGB vector or one of the MATLAB predefined names, specifying the edge color.

    See the reference page for more information on specifying color.

    Scalar alpha value in range [0 1]

    Transparency of textbox background. This property defines the degree to which the textbox background color is transparent. A value of (the default) makes to color opaque, a value of makes the background completely transparent (i.e., invisible). The default FaceAlpha is .

    Automatically adjust textbox height to fit text. MATLAB automatically wraps text strings to fit the width of the textbox. However, if the text string is long enough, it extends beyond the bottom of the textbox.

    When you set this mode to , MATLAB automatically adjusts the height of the textbox to accommodate the string.

    The fit-height-to-text behavior continues to apply if you resize the textbox from the two side handles.

    However, if you resize the textbox from any other handles, the position you set is honored without regard to how the text fits the box.

    Character slant. MATLAB uses this property to select a font from those available on your particular system. Generally, setting this property to or selects a slanted font.

    A name, such as

    Font family. A string specifying the name of the font to use for the textbox object. To display and print properly, this font must be supported on your system. The default font is .

    size in points

    Approximate size of text characters. A value specifying the font size to use in points. The default size is 10 (1 point = 1/72 inch).

    Weight of text characters. MATLAB uses this property to select a font from those available on your system. Generally, setting this property to or causes MATLAB to use a bold font.

    Horizontal alignment of text. This property specifies the horizontal justification of the textbox string. It determines where MATLAB places the string with respect to the value of the property's x value (the first element in the position vector).

    Interpret TEX instructions. This property controls whether MATLAB interprets certain characters in the property as TEX instructions (default) or displays all characters literally. See the text object property for a list of supported TEX instructions.

    To enable a complete TEX interpreter for text objects, set the property to .

    ----

    Line style of edge. This property specifies the line style of the textbox edge. Available line styles are shown in the following table.

    Specifier String
    Line Style

    Solid line (default)

    Dashed line

    Dotted line

    Dash-dot line

    No line
    scalar

    The width of the textbox edge. Specify this value in points (1 point = 1/72 inch). The default is 0.5 points.

    scalar pixel value

    Space around text. Specify a value in pixels that defines the space around the text string, but within the textbox.

    four-element vector [x, y, width, height]

    Size and location of textbox. Specify the lower-left corner of the textbox with the first two elements of the vector defining the point x, y. The third and fourth elements specify the width and height respectively.

    string

    The text string. Specify this property as a quoted string for single-line strings, or as a cell array of strings for multiline strings. MATLAB displays this string at the specified . See the property for more information on using TEX characters.

    Vertical alignment of text within textbox. This property specifies the vertical alignment of the text in the textbox. It determines where MATLAB places the string with respect to the value of the property's y value (the second element in the position vector). The possible values mean

    • -- Place the top of the string at the specified y-position.
    • -- Place the string so that the top of a capital letter is at the y-position.
    • -- Place the middle of the string at the y-position.
    • -- Place font baseline at the y-position.
    • -- Place the bottom of the string at the y-position.

    Previous page  Annotation Textarrow Properties ans Next page

    © 1994-2005 The MathWorks, Inc.


    Sours: http://matlab.izmiran.ru/help/techdoc/ref/annotationtextboxproperties.html

    Now discussing:

    .



    1468 1469 1470 1471 1472