Using placeholders (%d,%s) in plt.text (matplotlib.pyplot.text)

后端 未结 1 1085
一个人的身影
一个人的身影 2021-01-28 12:10

I am facing an issue in assigning a numerical value to the annotated text (mean and standard deviation in this case) using plt.text command.

Since I have six subplots, I

1条回答
  •  我在风中等你
    2021-01-28 12:28

    Try the following:

    for i, _ in enumerate(var): 
        plt.text(X_cord,Y_cord, r'$\mu=%s$' % (Mean[i]), fontsize=14)
    

    I prefer to use the string method.format:

    for i, _ in enumerate(var): 
        plt.text(X_cord,Y_cord, r'$\mu={}$'.format(Mean[i]), fontsize=14)
    

    0 讨论(0)
提交回复
热议问题