Skip to content

Instantly share code, notes, and snippets.

@avasilkov
Created April 26, 2015 21:08
Show Gist options
  • Save avasilkov/eac0361250937923dce4 to your computer and use it in GitHub Desktop.
Save avasilkov/eac0361250937923dce4 to your computer and use it in GitHub Desktop.
def xtick_formatter(x, fmt, td, p):
res = None
if x < p[-1][0]:
res = (p[-1][1] + (x - p[-1][0]) * td).strftime(fmt)
else:
#it's reversed
for i in p:
if i[0] <= x:
res = (i[1] + (x - i[0]) * td).strftime(fmt)
break
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment