This should be simple, but I haven't found it: I have a value (the coefficient R squared) previously calculated and I want to insert it in a legend in matplotlib. If the value calculated is r_squared
, this is not working:
plt.plot(x, y, linestyle='solid', color='k', label=r'Fitting line with $R^{2} = $, r_squared')
It just don't read the value.
Thanks.
You could just use string formatting :