As3adTintin
As3adTintin

Reputation: 2476

How do I get python to display xbar? A line over the letter x

I've been looking at math notation and different packages but have yet to find anything that lets me print xbar (the average x).

I am hoping to use xbar as a label in matplotlib.

Any suggestions?

Thank you. Cheers

Upvotes: 4

Views: 20877

Answers (2)

J. Khoury
J. Khoury

Reputation: 679

If you are using jupyter you can simply do this for one letter (x):

$\bar x$   

#or for a string   
$\overline {xyzabc}$   

#note that one $ will give you an inline output and $$...$$ would start  
#a new line after your output

Upvotes: 4

Rui Silva
Rui Silva

Reputation: 338

If you want to use x bar as a label in matplotlib, you can do it like this:

plt.ylabel(r'$\bar{x}$')

Upvotes: 11

Related Questions