Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Português


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 — Descrição de propriedades da entidade Label (rótulo)
  • titlepage — adiciona título no meio de uma janela de gráficos
  • xtitle — adidciona títulos a janelas de gráficos
  • x|y|zlabel — sets or updates the x-axis label or/and its properties
  • Interactive editor — Interactive plot editor
  • xstring — imprime strings
  • color_list — Lista dos nomes das cores
  • color — Retorna o identificador de uma cor
  • xlfont — carrega uma fonte em um contexto gráfico ou pergunta a fonte carregada
  • set — Ajusta um valor de propriedade de uma objeto entidade gráfica ou de um objeto Interface do Usuário (User Interface)

History

VersãoDescrição
6.1.0
  • The text becomes optional, to update only properties.
  • The full list of Scilab predefined colors names can now be used, as well as hexadecimal #RRGGBB colors codes.
  • Console-oriented usages are now possible, specifying any color index, font id, font size, or box angle as a string like "13" instead of 13, excepted for [r,g,b] and [x,y,z] position.
  • When a non-integer font size is specified, .fractional_font is now automatically turned "on". It is conversely forced to "off" for any input integer font size.
  • Any specified font name is now space-insensitive.
  • New property box="on"|"off" added.
  • New property tag added.
2025.0.0 Function returns the created handle(s).
Report an issue
<< legends annotation xlabel >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:16:53 CEST 2024