使用 matplotlib.pyplot.clabel 添加具有透明背景的标签

Using matplotlib.pyplot.clabel to add labels with a transparent background

对于matplotlib.pyplot.clabel,是否可以将标签添加到等高线图,而标签后面的白色 space 不会覆盖等高线的任何部分?当我尝试向等高线图添加标签时,它往往会用白色 space 覆盖部分等高线图。也许有一种方法可以使文本的背景透明?

使用inline参数

 plt.clabel(..., inline=False)