Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Plotting a dataframe with date unordered date index #2609

Closed
hayd opened this Issue · 2 comments

3 participants

@hayd
Collaborator

Migrated from StackOverflow. The following gives an exception (when trying to plot a DataFrame with date indices). I'm using '0.10.0b1'.

In [1]: df = DataFrame(randn(3,1),index=[date(2012,10,1),date(2012,9,1),date(2012,8,1)], columns=['test'])

#the same bug is present using datetime rather than date
In [2]: df
Out[2]: 
                test
2012-10-01 -0.315065
2012-09-01  0.100678
2012-08-01 -0.230353

In [4]: df.plot() 
#error

Here is the traceback:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit
    func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 254, in idle_draw
    self.draw()
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 239, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 421, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 898, in draw
    func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 1997, in draw
    a.draw(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1041, in draw
    ticks_to_draw = self._update_ticks(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 931, in _update_ticks
    tick_tups = [ t for t in self.iter_ticks()]
  File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 878, in iter_ticks
    majorLocs = self.major.locator()
  File "/usr/lib/pymodules/python2.7/matplotlib/dates.py", line 750, in __call__
    return self._locator()
  File "/usr/lib/pymodules/python2.7/pandas/tseries/converter.py", line 317, in __call__
    (estimate, dmin, dmax, self.MAXTICKS * 2))
RuntimeError: MillisecondLocator estimated to generate 5270400 ticks from 2012-08-01 00:00:00+00:00 to 2012-10-01 00:00:00+00:00: exceeds Locator.MAXTICKS* 2 (2000) 

Note that it plots ok, using df.sort().plot().

@mitlynk

I have memory deficits from medication. Did I send you an email or was it reported from the software.

@changhiskhan
Collaborator

Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.