title: How to make color the wick portion of a candlestick stick using matplotlib?
body: <p>I'm looking to make the wick portion of a candlestick stick black using matplotlib? I couldn't find any mention of it in the documentation, but I've seen pictoral examples showing that it can be done.</p>
  
  <p>here's what I currently have: </p>
  
  <p><a href="https://i.stack.imgur.com/QdKTD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QdKTD.png" alt="enter image description here"></a></p>
  
  <p>here's an example of the wicks being colored black:</p>
  
  <p><a href="https://i.stack.imgur.com/U3Jjm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U3Jjm.png" alt="enter image description here"></a></p>
  
  <p>Update:</p>
  
  <p>I used the solution provided below but changed the code slightly to remove the vertical line over the body area of the candlestick:</p>
  
  <pre><code>from matplotlib.lines import Line2D
  from matplotlib.patches import Rectangle
  
  
  def blackwickcandlestick(ax, quotes, width=0.2, colorup='#00FF00', colordown='#FF0000',
                           alpha=1.0, shadowCol='k', ochl=True):
  
      OFFSET = width / 2.0
  
      lines = []
      patches = []
      for q in quotes:
          if ochl:
              t, open, close, high, low = q[:5]
          else:
              t, open, high, low, close = q[:5]
  
          if close &gt;= open:
              color = colorup
              lower = open
              height = close - open
              vline = Line2D(
                  xdata=(t, t), ydata=(low, high),
                  color=colorup,      # This changed from the default implementation
                  linewidth=0.5,
                  antialiased=True,
                  )
          else:
              color = colordown
              lower = close
              height = open - close
              vline = Line2D(
                  xdata=(t, t), ydata=(low, high),
                  color=colordown,      # This changed from the default implementation
                  linewidth=0.5,
                  antialiased=True,
                  )
  
  
          rect = Rectangle(
              xy=(t - OFFSET, lower),
              width=width,
              height=height,
              facecolor=color,
              edgecolor=color,
          )
          rect.set_alpha(alpha)
  
          lines.append(vline)
          patches.append(rect)
          ax.add_line(vline)
          ax.add_patch(rect)
      ax.autoscale_view()
  
      return lines, patches
  
  
  import matplotlib.finance as mpl_finance
  
  mpl_finance._candlestick = blackwickcandlestick
  </code></pre>