title: How to Remove Weekends in Matplotlib Candlestick Chart?
body: <p>When plotting a candlestick chart in <code>matplotlib</code>, the plot leaves unsightly gaps over weekends. This happens because of breaks in the data due to markets being closed on weekends. How can the gaps over weekends be removed?</p>
  
  <p>Below is a simple example demonstrating the presence of gaps in the plot.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc
  
  date1, date2 = [(2006, 6, 1), (2006, 8, 1)]
  quotes_mpl = quotes_historical_yahoo_ohlc('INTC', date1, date2)
  
  fig, ax = plt.subplots()
  candlestick_ohlc(ax, quotes_mpl)
  ax.xaxis_date()
  plt.xticks(rotation=45)
  </code></pre>
  
  <p>Weekend gaps are shown by green arrows.</p>
  
  <p><a href="https://i.stack.imgur.com/YhE2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YhE2a.png" alt="enter image description here"></a></p>