Legend symbol overbar

175 Ansichten (letzte 30 Tage)
Robbie
Robbie am 24 Jan. 2012
Kommentiert: vidyadhar k am 2 Jul. 2018
Hi,
I am trying to include a single letter with an 'over-bar' after the percentage sign in the following code for a legend on a plot:
legend('CG = 33.46%','string2' )
If anyone has an idea of how to do this, then that would be really great.
Thanks,
Robbie

Akzeptierte Antwort

the cyclist
the cyclist am 24 Jan. 2012
plot(1:10)
h = legend('$$\overline{x}$$')
set(h,'Interpreter','latex','fontsize',24)
  6 Kommentare
the cyclist
the cyclist am 31 Jul. 2017
Bearbeitet: the cyclist am 31 Jul. 2017
symbol = '\omega_r^*';
h = legend(['before ','$$\overline{',symbol,'}$$',' after'])
set(h,'Interpreter','latex','fontsize',24)
Notice that the general technique here is to take a series of characters and concatenate them -- where one (or more) of the character arrays is predefined in a variable.
When I do that I like to build up from a completely manual version of the character, like ...
s = 'I am a character array'; % Nothing special
s = ['I am a character array']; % Concatenating, but no variables yet
s = ['I am a ','character array']; % Split the character array
s = ['I am a ','character',' array']; % Split again
and then finally
c = 'character';
s = ['I am a ',c,' array']; % Insert one portion from a variable
vidyadhar k
vidyadhar k am 2 Jul. 2018

Hello, the cyclist. I have a question too. I want to insert $\mathbf{\overline{Nu_{s}}}$ inside sprintf{' ') to get an overline on Nu. I am getting the error as Warning: Escaped character '\m' is not valid. See 'doc sprintf' for supported special characters

Any help would be appreciated. Thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by