So I know that if I want to use a LaTeX string in my plots I should instead of for example \"sin(x)\"
, I should use r\"\\sin(x)\"
.
But if I hav
Mind that to have MathText activated the string must be in between Dollar signs ($
).
In case your latex contains backslashes you need to either use a raw string from the beginning
a = r"$\tan(\nu\cdot x)$"
or escape the backslashes
a = "$\\tan(\\nu\\cdot x)$"
If you try something like in the other answer, you'd get unexpected results
a = "\tan(\nu\cdot x)"
b = r"$"+a+"$"
ax.plot(x, y, label=b)
results in