On Fri, Mar 12, 2010 at 1:15 PM, Alex S <sch...@gm...> wrote:
> Hi there, does anyone know if there's a simple way to set an axis limit to a
> date? "viewlim_to_dt()" looks promising, but I can't figure out how to use
> it...
If you've plotted using dates, just use dates for the limits:
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime, timedelta
s = datetime.now()
x = np.array([s, s + timedelta(hours=3)])
y = np.arange(1,3)
plt.plot(x,y)
plt.xlim(s - timedelta(minutes=30), s + timedelta(hours=4))
plt.show()
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
|