python - 在 matplotlib 中使用 pyplot.plot 时如何删除圆形标记的轮廓

标签 python matplotlib

我正在使用 pyplot.plot 生成散点图(而不是 scatter - 我在使用颜色图时遇到了困难)

我正在使用“o”标记来绘制一个圆圈,但圆圈总是有黑色轮廓。

如何去除轮廓,或调整其颜色?

最佳答案

要删除标记的轮廓并调整其颜色,请使用 markeredgewidth(又名 mew) , 和 markeredgecolor(又名 mec)。

使用 this as a guide :

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)

这会产生: plot result

如您所见,即使设置了标记边缘颜色,因为它的宽度设置为零,它也不会显示。

关于python - 在 matplotlib 中使用 pyplot.plot 时如何删除圆形标记的轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28403179/

相关文章:

Python:函数返回

python - 如何对 Pandas 的多索引进行分组?

python - 在 Python for 循环中创建多个绘图

python - matplotlib 中的 Pandas 自动日期时间格式

python - Matplotlib 添加一个特定的刻度表示轴最大值 - 多尺度单次观察

python - Numba 通过影响就地损坏数据

Python-标量的多个列表

python - Django:交叉引用

python - 使用 Matplotlib 绘制多级标题数据框

python - 如何使用 matplotlib 创建具有不同长度的多个数组的直方图,其中 y 轴上有百分比