Created
September 12, 2012 08:56
-
-
Save Jim-Holmstroem/3705378 to your computer and use it in GitHub Desktop.
Highlight a span on a timeseries plot using pandas and matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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