简体   繁体   English

在matplotlib散点图中更改标记的厚度

[英]Change the marker thickness in matplotlib scatter plot

I have the following marker in my python matplotlib scatter plot: 我的python matplotlib散点图中有以下标记:

在此处输入图片说明

made by the code: 由代码制成:

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

I want the X to be the same size, but I want the red part to be 'thinner'. 我希望X的大小相同,但我希望红色的部分“更细”。 More like a real 'X' I guess. 我猜更像一个真正的“ X”。

Is this possible? 这可能吗?

Thank you. 谢谢。

The thicker the edge, the thinner the face. 边缘越厚,脸越薄。 Alternatively a marker "x" can be used 或者,可以使用标记"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()

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM