math_expr = r"$ x \overset{f}{\rightarrow} y \underset{f}{\leftarrow} z $" plt.text(0.4, 0.5, math_expr, usetex=False)