【发布时间】:2020-09-22 08:12:13
【问题描述】:
我试图为图例只保留一位小数。绘图所基于的数据 (w_field) 具有 8 位小数的值。
w_field = np.genfromtxt('w_field.dat')
CV = plt.contour(w_field)
x,Vel = CV.legend_elements()
plt.legend(x,Vel, title= 'Vertical velocity (m/s)', fontsize= 10, bbox_to_anchor=(1.05, 1), loc='upper left')
plt.xlabel('Nx')
plt.ylabel('Ny')
【问题讨论】:
-
@ZarakiKenpachi 链接的解决方案不适合这种情况。第一个解决方案是填充轮廓。第二个使用
clabel,不适合短轮廓。
标签: python matplotlib legend