title: Matplotlib: how to have a transparent box plot face while a non-transparent line edge?
body: <p>I'm building a function to draw custom box plots.  I'd like the face of the boxes to be plain with slight transparency and I'd like a thin solid (non-transparent) line around each box face.  </p>
  
  <p>I've been attempting this by setting the parameters of the boxes after calling <code>matplotlib.pyplot.boxplot</code> as shown below.  </p>
  
  <p>When I view the plot to screen it shows what I would like.  However, when I create a pdf using, say, <code>matplotlib.pyplot.savefig("output.pdf")</code> the line is not solid, it's transparent also.  When I zoom into the pdf file this transparency is noticable.  </p>
  
  <p>Does anyone have an idea of how to make the line non-transparent while keeping the transparency of the box plot face?  </p>
  
  <p>Thanks in advance.  </p>
  
  <pre><code>from matplotlib import pyplot as plt
  import numpy as np
  
  data = {}
  data['a'] = np.arange(12)+1
  data['b'] = np.arange(14)+1
  data['c'] = np.arange(8)+1
  
  cols = ['red', 'blue', 'green']
  
  controls = ['trt_a', 'trt_b', 'trt_c']
  
  fig, ax = plt.subplots()
  
  boxplot_dict = ax.boxplot([data[x] for x in ['a', 'b', 'c']], \
      positions = [1, 1.5, 2], labels = controls, \
      patch_artist = True, widths = 0.25)
  
  for b, c in zip(boxplot_dict['boxes'], cols):
      b.set_alpha(0.6)
      b.set_edgecolor(c) # or try 'black'
      b.set_facecolor(c)
      b.set_linewidth(1)
  
  ax.set_ylim([0,16])
  
  plt.savefig("test_boxplot.pdf")
  plt.close()
  </code></pre>
  
  <p>I've tried the suggestion that was given for histograms <a href="https://stackoverflow.com/questions/28398200/matplotlib-plotting-transparent-histogram-with-non-transparent-edge">here</a>, by setting the colors to include the alpha level <code>[(0, 0, 1, 0.6), (1, 0, 0, 0.6), (0, 1, 0, 0.6)]</code> and that didn't seem to work for box plots.  </p>