pyplot.scatter 属性linewidths 表示散点的大小

测试代码:

import numpy as np 

import matplotlib.pyplot as plt 
#产生测试数据 
x = np.arange(1,10) 
y = x 
fig = plt.figure() 
ax1 = fig.add_subplot(111) 
#设置标题 
ax1.set_title('Scatter Plot') 
#设置X轴标签 
plt.xlabel('X') 
#设置Y轴标签 
plt.ylabel('Y') 
#画散点图 
lValue = x 
ax1.scatter(x,y,c='r',s= 20,linewidths=10,marker='d') 
#设置图标 
plt.legend('x1') 
#显示所画的图 

plt.show() 


注意marker要为o,0,d等这些封闭图形时 linewidths才有效果  以下是linewidths分别为1 和10 时的对比图:

linewidths=1

linewidths=10

猜你喜欢

转载自blog.csdn.net/CharlesOyfz/article/details/80283254