在matplotlib中使用pyplot.plot时如何删除圆形标记的轮廓 [英] How to remove outline of circle marker when using pyplot.plot in matplotlib

查看:37
本文介绍了在matplotlib中使用pyplot.plot时如何删除圆形标记的轮廓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我正在使用o"标记绘制一个圆,但该圆的轮廓始终为黑色.

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

解决方案

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

使用

您注意到,即使设置了标记边缘的颜色,因为它的宽度设置为零,它也不会显示.

I'm producing a scatter plot using pyplot.plot (instead of scatter - I'm having difficulties with the colormap)

I am plotting using the 'o' marker to get a circle, but the circle always has a black outline.

How do I remove the outline, or adjust its colour?

解决方案

To remove the outline of a marker, and adjust its color, use markeredgewidth (aka mew), and markeredgecolor (aka mec) respectively.

Using 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)

This produces:

As you notice, even though the marker edge color is set, because the width of it is set to zero it doesn't show up.

这篇关于在matplotlib中使用pyplot.plot时如何删除圆形标记的轮廓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆