简体   繁体   中英

Change the marker thickness in matplotlib scatter plot

I have the following marker in my python matplotlib scatter plot:

在此处输入图片说明

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'. More like a real 'X' I guess.

Is this possible?

Thank you.

The thicker the edge, the thinner the face. Alternatively a marker "x" can be used

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()

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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