# Strange time series plotting behavior / bug

This is a new one on me and extremely distressing:

If I plot 139 dates versus 139 values, everything is OK

In [40]: stamp = datetime.today()

In [44]: from datetime import timedelta

In [45]: inc = timedelta(1)

In [46]: stamps = [stamp + inc * i for i in xrange(139)]

In [47]: values = np.random.randn(139)

In [48]: plt.plot(stamps, values)
Out[48]: [<matplotlib.lines.Line2D at 0x6ed0e50>]

See plot 1 attached

However, if I increase it to 140 (!), all hell breaks loose:

In [49]: stamps = [stamp + inc * i for i in xrange(140)]

In [50]: values = np.random.randn(140)

In [51]: plt.plot(stamps, values)
Out[51]: [<matplotlib.lines.Line2D at 0x73a21d0>]

see plot 2

It seems to get ahold of itself at 153 dates (but not 152!). I tested
this both with git master and v1.1.0. I don't even know what to say.

thanks,
Wes

This is a new one on me and extremely distressing:

If I plot 139 dates versus 139 values, everything is OK

In [40]: stamp = datetime.today()

In [44]: from datetime import timedelta

In [45]: inc = timedelta(1)

In [46]: stamps = [stamp + inc * i for i in xrange(139)]

In [47]: values = np.random.randn(139)

In [48]: plt.plot(stamps, values)
Out[48]: [<matplotlib.lines.Line2D at 0x6ed0e50>]

See plot 1 attached

However, if I increase it to 140 (!), all hell breaks loose:

In [49]: stamps = [stamp + inc * i for i in xrange(140)]

In [50]: values = np.random.randn(140)

In [51]: plt.plot(stamps, values)
Out[51]: [<matplotlib.lines.Line2D at 0x73a21d0>]

see plot 2

It seems to get ahold of itself at 153 dates (but not 152!). I tested
this both with git master and v1.1.0. I don't even know what to say.

Confirmed. The AutoDateLocator is using an RRuleLocator which is cranking out a tick for every day. I suspect the problem is in AutoDateLocator.get_locator(); it is not finding what it is looking for, so it is falling back on a default. I can't look into it any time soon, so I hope someone else can; I'm not familiar with this code.

Eric

ยทยทยท

On 12/18/2011 01:13 PM, Wes McKinney wrote:

thanks,
Wes