Skip to content Skip to sidebar Skip to footer

Interference Between String Formatting And Latex Functions

Say I made a fit and obtained the parameter a (in reality there are more). Now I want to have a little piece of text inside a plot where the parameter and its unit is stated. The i

Solution 1:

You need to escape the curly brackets for the latex commands with another pair of curly brackets.

plt.text(0.5,0.5, r'${0:.1f}\frac{{kJ}}{{mol}}$'.format(a/1000)) 

Post a Comment for "Interference Between String Formatting And Latex Functions"