Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 678
Toam Avatar asked Feb 09 '15 05:02

Toam


People also ask

How do I make markers transparent in Matplotlib?

How to make the marker face color transparent without making the line transparent in Matplotlib? Create x_data and y_data(sin(x_data)), using numpy. Plot curve using x_data and y_data, with marker style and marker size. By changing the alpha, we can make it transparent to opaque.

How do you remove Pyplot from scientific notation?

If you want to disable both the offset and scientific notaion, you'd use ax. ticklabel_format(useOffset=False, style='plain') .


1 Answers

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.

like image 85
jrd1 Avatar answered Sep 20 '22 18:09

jrd1