title: matplotlib - control capstyle of line collection/large number of lines
body: <p>Similarly to a <a href="https://stackoverflow.com/questions/11312579/networkx-draw-networkx-edges-capstyle">previous question</a> of mine, I'd like to control the capstyle of lines being drawn using matplotlib. However, I have an extremely large number of lines, and drawing with anything other than a line collection takes way too long. Are there any workarounds to control the capstyle of lines in a line collection in a generic way (or alternatively, super fast ways of drawing a large number of <code>Line2D</code> lines). For instance, I've tried using the matplotlib rc settings via:</p>
  
  <pre><code>import matplotlib as mpl
  mpl.rcParams['lines.solid_capstyle'] = 'round'
  mpl.rcParams['lines.solid_joinstyle'] = 'round'
  </code></pre>
  
  <p>But this doesn't appear to have any affect. From the docstring for <code>collections.py</code>:</p>
  
  <blockquote>
    <p>The classes are not meant to be as flexible as their single element counterparts (e.g. you may not be able to select all line styles) but they are meant to be fast for common use cases (e.g. a large set of solid line segemnts)</p>
  </blockquote>
  
  <p>Which explains <em>why</em> I can't seem to control various parameters, but I still want to do it! I've had a look at the code for the AGG backend (<code>_backend_agg.cpp</code>: not that I really understand it), and it appears that line_cap and line_join are controlled by <code>gc.cap</code> and <code>gc.join</code>, where gc comes from the <code>GCAgg</code> class. Does anyone know how one can control this from Python? Am I asking the right question here? Perhaps that are easier ways to control these parameters?</p>
  
  <p>Any help is greatly appreciated... I'm desperate to get this working, so even crazy hacks are welcome!</p>
  
  <p>Thanks,</p>
  
  <p>Carson</p>