当前位置:主页 > 软件编程 > Python代码 >

Python matplotlib通过plt.scatter画空心圆标记出特定的点方法

时间:2021-03-08 11:35:22 | 栏目:Python代码 | 点击:

在用python画散点图的时候想标记出特定的点,比如在某些点的外围加个空心圆,一样可以通过plt.scatter实现

import matplotlib.pyplot as plt

x = [[1, 3], [2, 5]]
y = [[4, 7], [6, 3]]

for i in range(len(x)):

  plt.plot(x[i], y[i], color='r')
  plt.scatter(x[i], y[i], color='b')
  plt.scatter(x[i], y[i], color='', marker='o', edgecolors='g', s=200) # 把 corlor 设置为空,通过edgecolors来控制颜色

效果图

Python matplotlib通过plt.scatter画空心圆标记出特定的点

您可能感兴趣的文章:

相关文章