How do you enable "special" characters like "é" on figures?

I have to write elements like plot titles in french and those characters show up as blanks.
Simple example:
fplot(@(x) x^2, [0 5]);
title('éééé')

Answers (1)

You will probably have to use the LaTeX interpreter. See Text with Mathematical Expression Using LaTeX for details on calling it in MATLAB, and the LaTeX site for details on how to enter characters for various alphabets.

3 Comments

Thanks for the suggestion. What bugs me about this is that previously it was all working fine. I would write 'é' and it would show up on the figure as any other letter. And I didn't change version. It's as if the encoding changed for some reason.
I just tried it on my machine with a plot I just created, and it works perfectly, as your code did previously. See if char(0233) prints correctly.
My (too obvious) suggestion otherwise is to re-start MATLAB. If you are still having problems after that, contact MathWorks Tech Support.
I have seen discussions on getting Unicode characters to print, but 'é' is part of the ASCII character set, and you should have no problems with it.
Star Strider, ASCII ends at position 127 (or 126 depending on which ASCII you are looking at), but 'é' is beyond that at 233. 'é' is defined by a number of character sets, including the common ISO-8896-1, though you need ISO-8896-15 or ISO-8896-16 for complete support for French.
Support for characters in the range 128 to 255 in plots has existed for a number of years; I do not know when it first started. But you do need to be using a Font that supports the characters. If you have not explicitly specified the Font to use then there is a possibility that you are inheriting a default font; check
get(0, 'factoryTextFontName')
and so on for 'factoryUicontrolFontName', 'factoryUitableFontName', 'factoryAxesFontName', 'factoryTextFontName', 'factoryUipanelFontName'

Sign in to comment.

Asked:

on 9 Nov 2015

Commented:

on 10 Nov 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!