Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
490 views
in Technique[技术] by (71.8m points)

python - How to remove outline of circle marker when using pyplot.plot in matplotlib

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?

question from:https://stackoverflow.com/questions/28403179/how-to-remove-outline-of-circle-marker-when-using-pyplot-plot-in-matplotlib

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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: plot result

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...