Changing the text of clabel in Matplotlib
I would like to specify the text of my contour lab开发者_运维百科el (instead of the value of the contour I want to put a text) I've tried:
CS = contour(X, Y, Z, [0.5], linewidths=1, colors='k')
plt.clabel(CS, fontsize=10, inline=1, text=r'$\alpha=0$')
but it doesn't work. Any idea?
Try this:
plt.clabel(CS, fontsize=10, inline=1, fmt=r'$\alpha=0$')
精彩评论