x and y axis labels

xlabel('Gr^*\it\bf_x','FontWeight','bold','FontName','Times New Roman','Fontsize',12); ylabel('Nu\it\bf_x','FontWeight','bold','FontName','Times New Roman','Fontsize',12);
Instead of Nu_x or Gr_x I want Nu_x bar or Gr_x bar as axis title in MATLAB graph. What change do I need to do in the following lines?

댓글 수: 1

Oleg Komarov
Oleg Komarov 2011년 3월 16일
Can you please format the lines of code in your question with the code button?

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

답변 (2개)

Matt Fig
Matt Fig 2011년 3월 16일

0 개 추천

I am not sure why this doesn't work, but the latex for a bar is:
'\=x'
that is, according to: Latex cheat sheet
I tried to first set the interpreter to latex, then do this:
set(L,'string','R_{\=x}')
But I got the old, 'unable to interpret string' problem.
The documentation says that MATLAB supports full Latex, so I don't get it.
Matt Tearle
Matt Tearle 2011년 3월 16일

0 개 추천

Ah, the old LaTeX interpreter trap. Is this what you're after:
xlabel('$G\bar{r}_x$','FontWeight','bold','interpreter','latex');
The trick is the use of the $ signs to set it as an equation.
BTW, it doesn't seem possible to put the bar just on the x (ie on the subscript).
EDIT TO ADD Matt Fig found the right combination of TeX and curly braces to get a bar on a subscript: (Copied from comments below)
xlabel('$$G_{\bar{x}}$$','FontWeight','bold','interpreter','latex','fontsize',20)

댓글 수: 4

Matt Fig
Matt Fig 2011년 3월 16일
I think the OP wants the bar over the x subscript. Those $ get me every time!
Matt Fig
Matt Fig 2011년 3월 16일
It sure is:
xlabel('$$G_{\bar{x}}$$','FontWeight','bold','interpreter','latex','fontsize',20)
Oleg Komarov
Oleg Komarov 2011년 3월 16일
I don't get why overset is not supported...the bar is too short, or too long if overline instead of bar is used:
xlabel('$Gr^*\it\bf_{\bar{x}}$','fontw','bold','fonts',16,'interp','latex');
ylabel('$Nu\it\bf_{\bar{x}}$' ,'fontw','bold','fonts',16,'interp','latex');
Matt Tearle
Matt Tearle 2011년 3월 16일
@Matt F: Graargh. I thought I tried that permutation. Not enough curly braces, perhaps.
Anyway, nice work.

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

카테고리

제품

질문:

2011년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by