Reputation: 8015
I have a dataframe storing a time series, which looks like as follows. How to plot it using time column as x-axis
. Moreover, if I want to mark certain points between a given time period, e.g., 2014-11-18
to 2015-1-30
. How to do that using matplotlib
?
This is what I did, but it appears pretty small, and how to add some marks over the certain time period?
Upvotes: 1
Views: 783
Reputation: 6091
the easiest way to do this is to plot twice, the second plot having the extra style. Regarding the plot size, you can control the figsize
parameter. Just set a tuple with the height and width you like
# make sure index is in datetime format
df_id_ts.index = pd.to_datetime(df_id_ts.index, figsize=(10,6))
ax = df_id_ts.plot()
df_id_ts['2014-11-18' : '2015-01-30'].plot(ax = ax, marker = 'ro')
Upvotes: 1