Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Matlab does not plot greek letters

768 views
Skip to first unread message

Javier

unread,
May 4, 2012, 5:43:08 AM5/4/12
to

Hi,

I am trying to plot using greek letters in the title or axes as in latex:

plot(stuff)
ylabel('\sigma [\mu m]')


but it doesn't plot any greek letter but just

s [m m]

Do you have any idea of the reason? I am using Matlab under Fedora 12

Thanks a lot.

dpb

unread,
May 4, 2012, 4:53:07 PM5/4/12
to
...

Try setting the 'interpreter' property of the text object of the y-axis
label property.

h=ylabel('\sigma [\mu m]');
set(h,'interpreter','tex')

Hmmm...

>> get(h,'interpreter')
ans =
tex

I see here 'tex' is on by default; try and see what you get on your
system as above.

If it is 'on' and still doesn't display it's got to be a font/display
page or somesuch issue. At that point I have no clew re: Fedora, sorry.

--




--

Alexandre

unread,
Aug 15, 2012, 9:54:11 AM8/15/12
to
Hi,

I had the same problem with matlab R2012a on ubuntu 12.04.

I solved the problem by installing the tex fonts (installing texlive) and rebooting the computer.

"Javier" wrote in message <jo08bc$4af$1...@newscl01ah.mathworks.com>...

Valeriy

unread,
Aug 15, 2012, 4:48:20 PM8/15/12
to
"Javier" wrote in message <jo08bc$4af$1...@newscl01ah.mathworks.com>...

> I am trying to plot using greek letters in the title or axes as in latex:
>
> plot(stuff)
> ylabel('\sigma [\mu m]')
>
>
> but it doesn't plot any greek letter but just

I solved similar problem in following way:

ylabel('I($\theta, \varphi_{averaged}$), a.u.','interpreter','latex');

Good luck

Daniel Bertrand

unread,
Aug 4, 2016, 2:44:10 PM8/4/16
to
"Javier" wrote in message <jo08bc$4af$1...@newscl01ah.mathworks.com>...
>

Daniel Bertrand

unread,
Aug 4, 2016, 2:49:09 PM8/4/16
to
"Javier" wrote in message <jo08bc$4af$1...@newscl01ah.mathworks.com>...
>
Matlab does not recognise the \ in the string.
The solution is quite simple use \\
Good luck

dpb

unread,
Aug 4, 2016, 3:19:17 PM8/4/16
to
On 08/04/2016 1:49 PM, Daniel Bertrand wrote:
> "Javier" wrote in message <jo08bc$4af$1...@newscl01ah.mathworks.com>...
>> I am trying to plot using greek letters in the title or axes as in latex:
>>
>> plot(stuff)
>> ylabel('\sigma [\mu m]')
...

>> but it doesn't plot any greek letter but just
>> s [m m]
...

> Matlab does not recognise the \ in the string.
> The solution is quite simple use \\

Doubling up backslash will will simply pass the \ character; _not_ what
wanted at all.


ylabel('\sigma [\mu m]')

works fine here w/ R2012b/Windows. Don't know about Fedora but first OP
should check the 'interpreter' property default. The above is valid for
'TeX' but _not_ 'LaTex'

OP, try

hL=ylabel('\sigma [\mu m]','interpreter','tek');

and see if joy ensues. See what

get(hL,'interpreter')

returns...

--



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

0 new messages