You are on page 1of 5

Greek Letters and Special Characters in Graph Text - MATLAB & Sim...

http://www.mathworks.com/help/matlab/creating_plots/greek-letters-a...

You can add text to a graph that includes Greek letters and special characters using TeX markup. You also can use
TeX markup to add superscripts, subscripts, and modify the text type and color.

Include Greek Letters in Graph Text

Include Superscripts and Annotations in Graph Text

TeX Markup Options

Include Greek Letters in Graph Text


Create a simple line plot and add a title to the graph. Include the Greek letter
using the TeX markup \pi.

in the title by

Open This Example

x = linspace(0,2*pi);
y = sin(x);
plot(x,y)
title('x ranges from 0 to 2\pi')

Include Superscripts and Annotations in Graph Text


Create a line plot and add a title and axis labels to the graph. Display a superscript in the title
using the ^ character. The ^ character modifies the character immediately following it. Include
multiple characters in the superscript by enclosing them in curly braces {}. Include the Greek
letters and in the text using the TeX markups \alpha and \mu, respectively.

1 of 5

Open This Example

10-May-16 2:19 PM

Greek Letters and Special Characters in Graph Text - MATLAB & Sim...

http://www.mathworks.com/help/matlab/creating_plots/greek-letters-a...

t = 1:900;
y = 0.25*exp(-0.005*t);
figure
plot(t,y)
title('Ae^{\alphat} for A = 0.25 and \alpha = -0.0005')
xlabel('Time \musec')
ylabel('Amplitude')

Add text at the data point where t = 300. Use the TeX markup \bullet to add a marker to the specified point and
use \leftarrow to include an arrow pointing to the left. By default, the specified data point is to the left of the text.
txt = '\bullet \leftarrow 0.25t e^{-0.005t} at t = 300';
text(t(300),y(300),txt)

2 of 5

10-May-16 2:19 PM

Greek Letters and Special Characters in Graph Text - MATLAB & Sim...

http://www.mathworks.com/help/matlab/creating_plots/greek-letters-a...

TeX Markup Options


MATLAB supports a subset of TeX markup. Use TeX markup to add superscripts and subscripts, modify the text
type and color, and include special characters in the text string. MATLAB interprets text strings using TeX markup as
long as the Interpreter property of the text object is set to 'tex' (the default).
This table lists the supported modifiers with the Interpreter property set to 'tex'. Modifiers remain in effect until
the end of the text. Superscripts and subscripts are an exception because they only modify the next character or the
characters within the curly braces.

3 of 5

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 Set specifier as the


name of a font family. You can use this
in combination with other modifiers.

'\fontname{Courier} text'

\fontsize{specifier}

Font size Set specifier as a


numeric scalar value in point units to
change the font size.

'\fontsize{15} text'

\color{specifier}

Font color Set specifer as one of


these colors: red, green, yellow,
magenta, blue, black, white, gray,
darkGreen, orange, or lightBlue.

'\color{magenta} text'

\color[rgb]{specifier}

Custom font color Set specifier as '\color[rgb]{0,0.5,0.5} text'


a three-element RGB triplet.

10-May-16 2:19 PM

Greek Letters and Special Characters in Graph Text - MATLAB & Sim...

http://www.mathworks.com/help/matlab/creating_plots/greek-letters-a...

This table lists the supported special characters with the Interpreter property set to 'tex'.
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

\ldots

...

\perp

\surd

\prime

\wedge

\varpi

\0

\rceil

\rangle

\mid

\vee

\langle

\copyright

See Also
plot | text | title | xlabel | ylabel

More About

4 of 5

10-May-16 2:19 PM

Greek Letters and Special Characters in Graph Text - MATLAB & Sim...

5 of 5

Add Title, Axis Labels, and Legend to Graph

Include Variable Values in Graph Text

Add Text to Specific Points on Graph

http://www.mathworks.com/help/matlab/creating_plots/greek-letters-a...

10-May-16 2:19 PM