Thursday, October 29, 2015

Sample Python Codes plot value with date time axis in matplotlib

[1] plotting-time-in-python-with-matplotlib

#!/usr/bin/env python

import matplotlib.pyplot as plt
import datetime

ax = tuple([datetime.datetime(2015, 10, 27, 17, 17, sec) for sec in range(1,10)])
print ax

ay = tuple(range(1,10))

# Beautify the display format

When doing enough zoom in, it will display in macro seconds resolution. When zooming out enough,it will display dates.

No comments: