Matplotlib Contour Clabel Location

后端 未结 2 614
误落风尘
误落风尘 2020-12-16 12:36

I would like to control the location of matplotlib clabels on a contour plot, but without utilizing the manual=True flag in clabel. For example, I would like to specify an x

2条回答
  •  春和景丽
    2020-12-16 13:09

    Yes, there now is a way to control label locations! https://github.com/matplotlib/matplotlib/pull/642

    plt.figure()
    CS = plt.contour(X, Y, Z)
    manual_locations = [(-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)]
    plt.clabel(CS, inline=1, fontsize=10, manual=manual_locations)
    

提交回复
热议问题