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('éééé')

답변 (1개)

Star Strider
Star Strider 2015년 11월 9일

0 개 추천

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

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'

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2015년 11월 9일

댓글:

2015년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by