2

Given the following:

import matplotlib.pyplot as plt 
import numpy as np 

x = np.random.randn(60) 
y = np.random.randn(60)
x2 = np.random.randn(60)
y2 = np.random.randn(60)

plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r')
plt.show()

How would I plot this same data with dashed circles instead (where the outline of each circle is dashed instead of solid) for x 2 and y2 only?

Thanks in advance!

Update: I know this can be done with patches as in here, but I need it to be done via plt.scatter if possible because I will also be plotting another set of circles on the same plot and using patches messed with the chart dimensions (was way too thin).

Dance Party2
  • 7,214
  • 17
  • 59
  • 106

1 Answers1

6

Pass linestyle='--' to scatter.

plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r',
            linestyle='--')

enter image description here

For that marker size I would rather use linestyle=':' though.

Stop harming Monica
  • 12,141
  • 1
  • 36
  • 56
  • Thanks, Goyo. Here is the question I should have asked in the first place: http://stackoverflow.com/questions/41108055/matplotlib-plot-dashed-circles-using-plt-plot-instead-of-plt-scatter – Dance Party2 Dec 12 '16 at 19:24