Using this code
pivoted = df.reset_index(level=0).pivot_table(index='date',
columns='Speaker', values='raw_score')
resampled = pivoted.rolling(450, min_periods=1).mean()
resampled.plot()
I have produced this graph
However I would like to create a break in the x-axis which will remove some of the data in the middle that I am not interested in displaying. The broken x-axis, would span between 1992-2000 and 2006-2017 (leaving out 2000-2006). Any help would be useful, also if someone has suggestions for better smoothing that would be helpful too!
This question is different than the question that is linked below because my x-axis is a datetime object and is the index of my df 'resampled', which is a pivot table. Here is what my df 'resampled' looks like:
Speaker Allison Cohn Hoenig Hubbard etc...
date
1992-03-12 NaN NaN NaN NaN 1.174405
1992-05-11 NaN NaN NaN NaN 0.847486
1992-05-14 NaN NaN NaN NaN 0.417312
Python/Matplotlib - Is there a way to make a discontinuous axis?