title: Matplotlib: How to adjust linewidth in colorbar for contour plot?
body: <p>Here's a minimal example to generate a plot which illustrates my question:  </p>
  
  <pre><code>import matplotlib.pylab as plt
  import matplotlib.mpl as mpl
  import numpy as np
  import random
  
  data = [[random.random() for i in range(10)] for j in range(10)]
  
  [XT, YT] = np.meshgrid(np.arange(1,10+1,1), np.arange(1,10+1,1))
  
  cmap = mpl.cm.gray
  
  fig, ax = plt.subplots()
  
  CS = ax.contour(XT, YT, data,levels=np.arange(0,1+0.1,0.1),\
                  cmap=cmap,linewidths=0.75)
  CB = plt.colorbar(CS, ticks=np.arange(0,1+0.1,0.1))  
  
  plt.show()
  </code></pre>
  
  <p>The resulting figure looks like this:  </p>
  
  <p><img src="https://i.stack.imgur.com/0HONw.png" alt="gray_contours"></p>
  
  <p>I would like to keep the <code>linewidths</code> of the contour lines in the figure at <code>0.75</code> but increase them in the <code>colorbar</code> (for better readability).  </p>
  
  <p>How do I change the <code>linewidths</code> in the <code>colorbar</code> without changing them in the figure?</p>
  
  <p>I initially tried <code>CB.collections</code>, but the <code>colorbar</code> has no <code>collections</code>. Also, calling <code>colorbar</code> with an argument <code>linewidths=4.0</code> does not work (it's an unknown parameter). </p>
  
  <p><strong>Comment</strong><br>
  While typing this question I had this idea (<a href="http://en.wikipedia.org/wiki/Rubber_duck_debugging" rel="nofollow noreferrer">rubber duck debugging</a>):  </p>
  
  <pre><code>CS = ax.contour(XT, YT, data,levels=np.arange(0,1+0.1,0.1),\
              cmap=cmap,linewidths=4.0)
  CB = plt.colorbar(CS, ticks=np.arange(0,1+0.1,0.1))
  plt.setp(CS.collections , linewidth=0.75)
  </code></pre>
  
  <p>Basically, setting the initial <code>linewidths</code> to the desired level for the <code>colorbar</code>, then generating the <code>colorbar</code> and afterwards using <code>collections</code> on the original contour-lines to decrease their linewidth.<br>
  This works.  </p>
  
  <p><strong>But:</strong> Is there a way to directly control the <code>linewidths</code> in the <code>colorbar</code>?</p>