Toa*_*oam 34 python matplotlib
我正在使用pyplot.plot生成散点图(而不是散点图 - 我对色图有困难)
我正在使用'o'标记绘制圆圈,但圆圈总是有黑色轮廓.
如何移除轮廓或调整其颜色?
jrd*_*rd1 44
要删除标记的轮廓并调整其颜色,请分别使用markeredgewidth(aka mew)和markeredgecolor(aka mec).
使用这个作为指导:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x,
y,
color='blue',
marker='o',
fillstyle='full',
markeredgecolor='red',
markeredgewidth=0.0)
Run Code Online (Sandbox Code Playgroud)
正如您所注意到的,即使设置了标记边缘颜色,因为它的宽度设置为零,它也不会显示.
来自pyplotAPI文档:
markeredgecolor或mec任何matplotlib颜色
例:
In [1]: import matplotlib.pyplot as plt
In [2]: import numpy as np
In [3]: x = np.linspace(0,1,11)
In [4]: y = x * x
In [5]: plt.plot(x,y,'o',color="red", ms=15, mec="red")
Out[5]: [<matplotlib.lines.Line2D at 0x34e1cd0>]
In [6]: plt.show()
Run Code Online (Sandbox Code Playgroud)
产量:

这就是你要找的东西吗?