更改matplotlib散点p中的标记厚度

2024-04-19 02:23:41 发布

您现在位置:Python中文网/ 问答频道 /正文

在python matplotlib散点图中有以下标记:

enter image description here

代码制定:

plt.scatter(x,y,c=z,cmap=cm.bwr,marker='X',s=800,linewidth=1,edgecolor='k')

我希望X的尺寸相同,但我希望红色部分“更薄”。我想更像是个“X”。在

这可能吗?在

谢谢。在


Tags: 代码标记matplotlib尺寸cmpltmarkercmap
1条回答
网友
1楼 · 发布于 2024-04-19 02:23:41

边越厚,脸越薄。或者,可以使用标记"x"

import matplotlib.pyplot as plt


for lw in [1,3,5,7]:
    plt.scatter([lw], [1], c="gold", s=1000, marker="X", 
                linewidth=lw, edgecolor='k')
    plt.scatter([lw], [0], c="gold", s=lw*300, marker="x")

plt.margins(.2)
plt.show()

enter image description here

相关问题 更多 >