Alex S 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...
>
> Thanks a lot,
> Alex
>
Alex,
I've done something like this in the past:
ax.set_xlim( ( min_val, max_val ) )
# improve formatting
fig.autofmt_xdate( bottom = 0.20000000000000001, rotation = 30,
ha = 'right' )
where min_val and max_val are values from
matplotlib.dates.date2num( dt ) because
dt is a datetime object, which is not the format matplotlib
uses.
So, setting the xlimit ( or ylimit ) using the values expected by
matplotlib manually is one option.
def date2num(d):
"""
*d* is either a :class:`datetime` instance or a sequence of datetimes.
Return value is a floating point number (or sequence of floats)
which gives number of days (fraction part represents hours,
minutes, seconds) since 0001-01-01 00:00:00 UTC.
"""
-Erik
--
View this message in context:
http://old.nabble.com/xlim-with-dates-tp27881612p27882067.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users