cnt = plt.tricontourf(x, y, z, levels=levels, cmap="ocean") # This is the fix for the white lines between contour levels for c in cnt.collections: c.set_edgecolor("face") plt.savefig("test.pdf")