DataTipTemplate - Data tip content and appearance - MATLAB (original) (raw)
DataTipTemplate Properties
Data tip content and appearance
DataTipTemplate
properties control the content and appearance of data tips. By changing property values, you can modify certain aspects of data tips.
p = plot(1:10); dtt = p.DataTipTemplate
DataTipRows
— Row content
array of DataTipTextRow
objects
Row content, specified as an array of DataTipTextRow objects.
You can modify the existing rows by setting properties of theDataTipTextRow
objects. Access a particular row by indexing into the array of objects.
Example: dtt.DataTipRows(1).Label = 'My label'
changes the label for the first row.
Example: dtt.DataTipRows(1).Value = 'YData'
changes the value source for the first row to use the YData
property of the plotted object.
Example: dtt.DataTipRows(1).Format = 'usd'
changes the value format for the first row.
Alternatively, you can add new rows to the data tip using thedataTipTextRow
function.
Example: dtt.DataTipRows(end+1) = dataTipTextRow(label,value)
adds a new row to the data tip with the specified label and value source.
Font
Font name, specified as a supported font name or "FixedWidth"
. 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 "FixedWidth"
. The fixed-width font relies on the root FixedWidthFontName property. Setting the root FixedWidthFontName
property causes an immediate update of the display to use the new font.
FontSize
— Font size
10 (default) | scalar value greater than zero
Font size, specified as a scalar value greater than zero in point units. One point equals 1/72
inch.
Character slant, specified as 'normal'
or'italic'
.
Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.
Text interpreter, specified as one of these values:
'tex'
— Interpret characters using a subset of TeX markup.'latex'
— Interpret characters using LaTeX markup.'none'
— 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 'tex'
, the supported modifiers are as follows.
Modifier | Description | Example |
---|---|---|
^{ } | Superscript | 'text^{superscript}' |
_{ } | Subscript | 'text_{subscript}' |
\bf | Bold font | '\bf text' |
\it | Italic font | '\it text' |
\sl | Oblique font (usually the same as italic font) | '\sl text' |
\rm | Normal font | '\rm text' |
\fontname{specifier} | Font name — Replace_specifier_ with the name of a font family. You can use this in combination with other modifiers. | '\fontname{Courier} text' |
\fontsize{specifier} | Font size —Replace_specifier_ with a numeric scalar value in point units. | '\fontsize{15} text' |
\color{specifier} | Font color — Replace_specifier_ with one of these colors: red, green,yellow, magenta,blue, black,white, gray,darkGreen, orange, orlightBlue. | '\color{magenta} text' |
\color[rgb]{specifier} | Custom font color — Replace_specifier_ with a three-element RGB triplet. | '\color[rgb]{0,0.5,0.5} text' |
This table lists the supported special characters for the'tex'
interpreter.
Character Sequence | Symbol | Character Sequence | Symbol | Character Sequence | Symbol |
---|---|---|---|---|---|
\alpha | α | \upsilon | υ | \sim | ~ |
\angle | ∠ | \phi | ϕ | \leq | ≤ |
\ast | * | \chi | χ | \infty | ∞ |
\beta | β | \psi | ψ | \clubsuit | ♣ |
\gamma | γ | \omega | ω | \diamondsuit | ♦ |
\delta | δ | \Gamma | Γ | \heartsuit | ♥ |
\epsilon | ϵ | \Delta | Δ | \spadesuit | ♠ |
\zeta | ζ | \Theta | Θ | \leftrightarrow | ↔ |
\eta | η | \Lambda | Λ | \leftarrow | ← |
\theta | θ | \Xi | Ξ | \Leftarrow | ⇐ |
\vartheta | ϑ | \Pi | Π | \uparrow | ↑ |
\iota | ι | \Sigma | Σ | \rightarrow | → |
\kappa | κ | \Upsilon | ϒ | \Rightarrow | ⇒ |
\lambda | λ | \Phi | Φ | \downarrow | ↓ |
\mu | µ | \Psi | Ψ | \circ | º |
\nu | ν | \Omega | Ω | \pm | ± |
\xi | ξ | \forall | ∀ | \geq | ≥ |
\pi | π | \exists | ∃ | \propto | ∝ |
\rho | ρ | \ni | ∍ | \partial | ∂ |
\sigma | σ | \cong | ≅ | \bullet | • |
\varsigma | ς | \approx | ≈ | \div | ÷ |
\tau | τ | \Re | ℜ | \neq | ≠ |
\equiv | ≡ | \oplus | ⊕ | \aleph | ℵ |
\Im | ℑ | \cup | ∪ | \wp | ℘ |
\otimes | ⊗ | \subseteq | ⊆ | \oslash | ∅ |
\cap | ∩ | \in | ∈ | \supseteq | ⊇ |
\supset | ⊃ | \lceil | ⌈ | \subset | ⊂ |
\int | ∫ | \cdot | · | \o | ο |
\rfloor | ⌋ | \neg | ¬ | \nabla | ∇ |
\lfloor | ⌊ | \times | x | \ldots | ... |
\perp | ⊥ | \surd | √ | \prime | ´ |
\wedge | ∧ | \varpi | ϖ | \0 | ∅ |
\rceil | ⌉ | \rangle | 〉 | \mid | | |
\vee | ∨ | \langle | 〈 | \copyright | © |
LaTeX Markup
To use LaTeX markup, set the interpreter to 'latex'
. For inline mode, surround the markup with single dollar signs ($
). For display mode, surround the markup with double dollar signs ($$
).
LaTeX Mode | Example | Result |
---|---|---|
Inline | '$\int_1^{20} x^2 dx$' | ![]() |
Display | '$$\int_1^{20} x^2 dx$$' | ![]() |
The displayed text uses the default LaTeX font style. TheFontName
, FontWeight
, andFontAngle
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/.
Tips
Control the behavior of data tips by modifying properties of the datatip object.
Version History
Introduced in R2019a