I have a list of variables that are Greek letters (56 variables so too many to do it per Hand). I would like to write those Greek letters in a matplotlib xlabel that it shows something like this in the xlabel:
I tried the following code:
my_variable_list = ['\theta_m','\Omega_b h**2',..........,'log(A)']
plt.xlabel(r' $%s$ ' % my_variable_list[1])
but this doesn't work... It shows:
Does someone have an idea on how to do this?
CodePudding user response:
It's working for me with %s
, if '\theta'
didnt work use '\\theta'
.