having issues using set_xlim. (possibly because of datetime objects??)
here's my code (doing it in ipython notebook):
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import datetime
date_list = [datetime.datetime(2015, 6, 20, 0, 0), datetime.datetime(2015, 6, 21, 0, 0), datetime.datetime(2015, 6, 22, 0, 0), datetime.datetime(2015, 6, 23, 0, 0), datetime.datetime(2015, 6, 24, 0, 0), datetime.datetime(2015, 6, 25, 0, 0), datetime.datetime(2015, 6, 26, 0, 0)]
count_list = [11590, 10743, 27369, 31023, 30569, 31937, 30205]
fig=plt.figure(figsize=(10,3.5))
ax=fig.add_subplot(111)
width = 0.8
tickLocations = np.arange(7)
ax.set_title("Turnstiles Totals for Lexington Station C/A A002 Unit R051 from 6/20/15-6/26-15")
ax.bar(date_list, count_list, width, color='wheat', edgecolor='#8B7E66', linewidth=4.0)
ax.set_xticklabels(date_list, rotation = 315, horizontalalignment = 'left')
This gives me:
But when I try to make some extra space on the leftmost and rightmost edges with this code:
ax.set_xlim(xmin=-0.6, xmax=0.6)
I get this huge error (this is just the bottom snippet):
223 tz = _get_rc_timezone()
224 ix = int(x)
--> 225 dt = datetime.datetime.fromordinal(ix)
226 remainder = float(x) - ix
227 hour, remainder = divmod(24 * remainder, 1)
ValueError: ordinal must be >= 1
Any idea what's going on guys? thanks!