When plotting a DataFrame with pandas:
import pandas as pd
import matplotlib.pyplot as plt
from StringIO import StringIO
mycsv = StringIO("""
time;openBid;highBid;lowBid;closeBid;openAsk;highAsk;lowAsk;closeAsk;volume
2015-12-06T22:00:00.000000Z;1.08703;1.08713;1.08703;1.08713;1.08793;1.08813;1.08793;1.08813;2
2015-12-07T22:00:05.000000Z;1.08682;1.08682;1.08662;1.08662;1.08782;1.08782;1.08762;1.08762;2
2015-12-08T22:01:20.000000Z;1.08683;1.08684;1.08681;1.08684;1.08759;1.08768;1.08759;1.08768;4
2015-12-09T22:01:30.000000Z;1.08676;1.08676;1.08676;1.08676;1.0876;1.0876;1.0876;1.0876;1
2015-12-10T00:03:00.000000Z;1.08675;1.08675;1.08675;1.08675;1.08737;1.08737;1.08737;1.08737;1
2015-12-06T22:03:10.000000Z;1.08675;1.08675;1.08675;1.08675;1.08728;1.08728;1.08728;1.08728;1
2015-12-06T22:03:50.000000Z;1.08676;1.08676;1.08676;1.08676;1.08728;1.08728;1.08728;1.08728;1
""")
df = pd.read_csv(mycsv, delimiter=';', parse_dates=True, index_col='time', header=0)
spr = df['lowAsk']-df['lowBid']
spr.plot()
plt.show()
I get this:
Question:
How to add ticks+labels+grid on x-axis for each day?
Example: Sun 06, Mon 07, Tue 08
, etc.
I tried various things like plt.axis(...)
but it was mostly unsucessful.