title
displays a title above a graphic axes, or updates its properties.
Syntax
title(text) title(text, property_name, property_value,...) title(property_name, property_value,...) title(axes_handle,...) h = title(...)
Arguments
- text
Matrix of text of the title. A title can have multiple rows or/and columns of text. Leading and trailing blanks are trimmed. In their columns, texts are left-justified. LaTeX expressions delimited with "$...$" are supported.
- axes_handle
Handle of the axes whose title must be set or updated. By default, the current axes is processed. Otherwise, the given axes is set as and remains the current one after returning from
title()
.- property_name, property_value,...
unlimited series of pairs of property name (word) and the respective value to assign to it. The available properties are related to labels properties). Some of them have an alias that can be used as well with
title()
:visible "on"
or"off"
. If"off"
, the title (and its box) still exists but is not displayed.fontsize font_size Scalar positive number specifying the size of displayed characters. default = 1. For any non-integer size, the font is scaled accordingly and anti-aliased (made a bit foggy). fontname font_style Ten font names are available (case and space unsensitive string), or their related id number: 0 "courrier" 2 "times" 6 "helvetica" 1 "symbol" 3 "times italic" 7 "helvetica italic" 4 "times bold" 8 "helvetica bold" 5 "times bold italic" 9 "helvetica bold italic" For instance, 3, "3", "times italic", "timesitalic" or "TimesItalic" are equivalent.
Other fonts can be loaded with
xlfont()
and used.color font_foreground Color of the text of the title (*). position Vector of coordinates of the title's anchor, in data unit. The anchor is the lower-left corner of the box of the title (when horizontal). Note: This property can't be set with a console-oriented syntax. rotation font_angle Direct (anti-clockwise) angle of the title's block, in degrees, horizontal = 0°. The lower-left corner of the box bounding the horizontal title is used as pivot (fixed point). box "off" | "on": hides or displays a box around the block of text of the title. edgecolor foreground Color of the border of the box (if any)(*).The box is then automatically turned "on". background backgroundcolor Filling color of the box background, behind the text (*). The box is then automatically turned "on". tag String or matrix of strings: Custom literal identifier of the title. (*) Any color can be specified by any of the following:
- Its numerical or literal index in the current colormap (like 13 or "13"). Special values whatever is the colormap: -1 for black, -2 for white.
- Its name as a string, if it is a predefined listed color. For colors among the short list ["red","green","blue","cyan","magenta","yellow","black","white"], shortened names are supported, like "m" for magenta or "k" for "black".
- Its "#RRGGBB" hexadecimal code, as a string.
- the [r,g,b] row of its Red/Green/Blue 0 ≤ r,g,b ≤ 1 intensities. This syntax can't be used in console-oriented mode.
- h
This optional output contains a handle to the created Label entity. Use
h
to modify its properties. For a list of properties, see label_properties.
Description
title() is used to set and display a title at the top of the current or given axes, or to change properties of the existing title.
title()
can be called with a functional syntax like
title("My title", "fontsize", 3)
or with an equivalent
console-oriented syntax like title "My title" fontsize 3
.
However, [r,g,b] row color and [x,y] coordinates specifications can't be used
in console-oriented syntaxes.
When an axes handle is specified as the target axes, it becomes the current axes
and remains as is after leaving title(). |
Examples
plot2d([], [], 0, "011", " ", [0 0 1 1]) // display a title with its default properties title 'my title' // change the color for the font title color blue // change the color for the edge of the surrounding box, and displays the box title edgecolor red // change the position of the title title('position', [0.3 0.8]); // change the size of the font title fontsize 3 // a rotation title rotation 90 // We can do all these modifications with just the below instruction: title('my title','color','blue','edgecolor','red','fontsize',3,'rotation',90,'position',[0.3 0.8]);
See also
- label_properties — Properties of Axes labels and title
- titlepage — ajoute un titre au milieu d'une fenêtre graphique
- xtitle — add titles on a graphics window
- x|y|zlabel — sets or updates the x-axis label or/and its properties
- Interactive editor — Interactive plot editor
- xstring — dessine des chaînes de caractères
- color_list — liste des noms de couleurs prédéfinies
- color — returns the color id of a color
- xlfont — load a font in the graphic context or query loaded font
- set — set properties of some graphic objects or uimenus or uicontrol interactive components
History
Version | Description |
6.1.0 |
|
2025.0.0 | Function returns the created handle(s). |
Report an issue | ||
<< legends | annotation | xlabel >> |