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

前端 未结 3 1872
失恋的感觉
失恋的感觉 2020-12-25 11:25

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 circl

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-25 12:27

    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.

提交回复
热议问题