title: plot pandas period_range with matplotlib - set freq of axis
body: <p>I got a pandas DataFrame with values for time spans with variable lenths. I want to plot a horizontal line for the value of each timespan with the length of the timespan. Therfore, I converted the timespan to an PeriodIndex by</p>
  
  <pre><code>ax0=fig.add_axes([.16,.2,0.8,.7])
  ax0.plot_date(data['periodIndex'], data['value'])
  </code></pre>
  
  <p>which produces:</p>
  
  <pre><code>TypeError: Axis must have `freq` set to convert to Periods
  </code></pre>
  
  <p>so my Question is how to set the frequency of my xaxis</p>
  
  <p>Thanks a lot for your help</p>
  
  <p>Axel</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>this is part of the pandas dataFrame I want to plot</p>
  
  <pre><code>     start        stop          A           B          C
  ID                                                                    
  1    2015-08-17   2015-08-25    -5.684246  -34.759047  10.714920   
  2    2015-08-25   2015-09-02   -10.850721  -78.443556   8.362215   
  3    2015-09-02   2015-09-15    -7.139351  -47.814199   9.300612   
  4    2015-09-15   2015-09-21    -7.822367  -56.895241   5.683696   
  5    2015-09-21   2015-09-29    -6.491543  -42.947744   8.984596   
  6    2015-09-29   2015-10-05    -9.897980  -67.985256  11.198583  
  </code></pre>
  
  <p>I solved the problem and now it looks like
  <a href="http://i.stack.imgur.com/wB1mI.png" rel="nofollow">this</a>
  by the following code</p>
  
  <pre><code>firstDate=df.ix[df.index[0]]['start']
  
  fig=plt.figure(figsize=(9*1.5,6*1.5))
  ax0=fig.add_axes([.15,.2,0.75,.7])
  
  ax0.set_xticks(df['start_abs'])
  ax0.set_xticklabels([i.date() for i in df['start']], rotation='vertical')
  
  B=ax0.twinx()
  B.set_ylim(-200,0)
  
  for _index, _series in df.iterrows():
      start=_series['start']
      stop=_series['stop']   
      df.ix[_index, 'start_abs']=(start-firstDate).days
      df.ix[_index, 'width_abs']=(stop-start).days
      df.ix[_index, 'stop_abs']=(stop-firstDate).days
  
      line_A=ax0.hlines(y=df.ix[_index,'A'], xmin=df.ix[_index, 'start_abs'], xmax=df.ix[_index, 'stop_abs'], colors='r')
      line_A.set_linewidths(3)
      text_A=ax0.text(df.ix[_index, 'start_abs'], df.ix[_index,'A'], '{a:4.2f}'.format(a=df.ix[_index,'A']), fontsize=8, color='r')
  
      line_B=B.hlines(y=df.ix[_index,'B'], xmin=df.ix[_index,'start_abs'], xmax=df.ix[_index,'stop_abs'], colors='k')
      line_B.set_linewidths(3)
      text_B=B.text(df.ix[_index,'start_abs'], df.ix[_index,'B'], '{a:4.2f}'.format(a=df.ix[_index,'B']), fontsize=8, color='k')
  
  plt.show()
  </code></pre>