从 matplotlib 中的 PolyCollection 中删除边缘线

dur*_*2.0 5 matplotlib

在此输入图像描述我正在用如下线绘制一些数据:

poly = PolyCollection(vertices, array=s, edgecolors='w', linewidths=.0001)

有没有办法完全隐藏每个单元格周围的边缘线?上面的行尝试通过将边缘颜色设置为白色和较小的线宽来实现此目的。然而,线条仍然出现。另外,将 0 传递给线宽似乎也不能做到这一点。

我也尝试过设置edgecolornonelinewidth0 但没有成功。

有什么建议么?

cel*_*cel 3

有多种方法可以隐藏边缘。感谢Ajean在评论中提出的其他建议。

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

vertices = [
    [(0.2,0.2), (0.7,0.3), (0.1, 0.6)],
    [(0.5,0.5), (0.6 ,0.8), (0.8, 0.6)]
]

poly0 = mpl.collections.PolyCollection(vertices)
poly1 = mpl.collections.PolyCollection(vertices, edgecolor="none")
poly2 = mpl.collections.PolyCollection(vertices, linewidths=0)
poly3 = mpl.collections.PolyCollection(vertices, color="blue")

fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(10,10))
ax1.add_collection(poly0)
ax2.add_collection(poly1)
ax3.add_collection(poly2)
ax4.add_collection(poly3)
Run Code Online (Sandbox Code Playgroud)

阴谋