Skip to content

Instantly share code, notes, and snippets.

@Jim-Holmstroem
Created September 12, 2012 08:56
Show Gist options
  • Save Jim-Holmstroem/3705378 to your computer and use it in GitHub Desktop.
Save Jim-Holmstroem/3705378 to your computer and use it in GitHub Desktop.
Highlight a span on a timeseries plot using pandas and matplotlib
def render_split(time, color, offset = -4*pd.datetools.Minute(15)):
if(color is not None):
pl.gca().axvspan(
time + offset,
time + pd.datetools.Minute(15) + offset,
facecolor = pl.cm.Paired( float(color % 12)/12 ),
linewidth = 0,
alpha = 1.0,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment