Inserting a previously calculated value in a legend in matplotlib

后端 未结 1 1352
[愿得一人]
[愿得一人] 2021-01-23 22:43

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

相关标签:
1条回答
  • 2021-01-23 23:39

    You could just use string formatting :

    plt.plot(x, y, linestyle='solid', color='k', label="Fitting line with $R^{{2}} = {}".format(r_squared))
    
    0 讨论(0)
提交回复
热议问题