如何在Python中用空心圆做散点图?
·
回答问题
在 Python 中,使用 Matplotlib,如何绘制带有 empty 圆圈的散点图?目标是在scatter()
已经绘制的_一些_ 彩色圆盘周围绘制空圆圈,以便突出显示它们,理想情况下无需重新绘制彩色圆圈。
我试过facecolors=None
,无济于事。
Answers
从文档分散:
Optional kwargs control the Collection properties; in particular:
edgecolors:
The string ‘none’ to plot faces with no outlines
facecolors:
The string ‘none’ to plot unfilled outlines
尝试以下操作:
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(60)
y = np.random.randn(60)
plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.show()
注: 对于其他类型的地块,请参阅这篇文章关于markeredgecolor
和markerfacecolor
的使用。
更多推荐
所有评论(0)