title: How to make Matplotlib scatterplots transparent as a group?
body: <p>I'm making some scatterplots using Matplotlib (python 3.4.0, matplotlib 1.4.3, running on Linux Mint 17). It's easy enough to set alpha transparency for each point individually; is there any way to set them as a group, so that two overlapping points from the same group don't change the color?</p>
  
  <p>Example code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  def points(n=100):
      x = np.random.uniform(size=n)
      y = np.random.uniform(size=n)
      return x, y
  x1, y1 = points()
  x2, y2 = points()
  fig = plt.figure(figsize=(4,4))
  ax = fig.add_subplot(111, title="Test scatter")
  ax.scatter(x1, y1, s=100, color="blue", alpha=0.5)
  ax.scatter(x2, y2, s=100, color="red", alpha=0.5)
  fig.savefig("test_scatter.png")
  </code></pre>
  
  <p>Results in this output:</p>
  
  <p><img src="https://i.stack.imgur.com/wAZ0p.png" alt="enter image description here"></p>
  
  <p>but I want something more like this one:</p>
  
  <p><img src="https://i.stack.imgur.com/yHYTx.png" alt="enter image description here"></p>
  
  <p>I can workaround by saving as SVG and manually grouping then in Inkscape, then setting transparency, but I'd really prefer something I can code. Any suggestions?</p>