get_xlim of dates

Hi,

My X axis represents dates. When I used get_xlim(), I got something like 735461.0 and 735490.5. What are these values? How can I convert to python date objects?

Many thanks,
Tom

Please, read the documentation of datetime.

Your data are *ordinals*, numbers which pack the data: year, month, etc. into one number ; the same strategy is used in spreadsheets, e.g., Excel.

If r=r=735461, then

datetime.fromordinal(r) gives: datetime.datetime(2014, 8, 16, 0, 0), unless I am mistaken...

···

Le 16/09/2014 17:31, Xiaobo Yang a écrit :

My X axis represents dates. When I used get_xlim(), I got something like 735461.0 and 735490.5. What are these values? How can I convert to python date objects?

==
This is the first approximation ... the "proleptic Gregorian ordinals" are integers. You have floats, and this probably is converted into fractions of a day / hour, etc. Read also something about timestamps.

Regards.

Jerzy Karczmarczuk

See the matplotlib dates documentation at

http://matplotlib.org/api/dates_api.html

···

On Sep 16, 2014, at 11:31 AM, Xiaobo Yang <xiaobo.yang@...287...> wrote:

Hi,

My X axis represents dates. When I used get_xlim(), I got something like 735461.0 and 735490.5. What are these values? How can I convert to python date objects?

Many thanks,
Tom

many thanks - was struggling to find out where’s the document!

···

On 16 September 2014 17:20, Scott Lasley <slasley@…2425…> wrote:

On Sep 16, 2014, at 11:31 AM, Xiaobo Yang <xiaobo.yang@…287…> wrote:

Hi,

My X axis represents dates. When I used get_xlim(), I got something like 735461.0 and 735490.5. What are these values? How can I convert to python date objects?

Many thanks,

Tom

See the matplotlib dates documentation at

http://matplotlib.org/api/dates_api.html