0

I want to add some text to a python plot. I'm using r'$\bar{p}$', but I want the bar to be at the bottom. I tried to use latex package accent and write r'$\usepackage{accents} \underaccent{\bar}{p}$'. But it doesn't work.

Any idea how to do that? Thanks in advance.

lilysirius
  • 124
  • 2
  • 10

1 Answers1

0

This is not ideal, since the \underline produces a slightly different line than \underaccent, but you could still use it the way mentioned in this answer.
To give the letter p the same font as in latex formula, you can use \underline{$p$}.

Here is a short example:

import matplotlib.pyplot as plt
from matplotlib import rc
rc('text',usetex=True)
import numpy as np

x=np.arange(-5,5,0.1)
ax.plot(x,np.sin(x),label=r'\underline{$p$}')
ax.legend()
f.show()
Community
  • 1
  • 1
Kantenkopp
  • 65
  • 7