Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting broken if inferred_freq has a multiple #1357

Closed
wesm opened this issue May 31, 2012 · 0 comments
Closed

Plotting broken if inferred_freq has a multiple #1357

wesm opened this issue May 31, 2012 · 0 comments
Labels
Bug Datetime Datetime data dtype Visualization plotting
Milestone

Comments

@wesm
Copy link
Member

wesm commented May 31, 2012

Also reported on mailing list

In [4]: ts.plot()
Out[4]: <matplotlib.axes.AxesSubplot at 0x41cc310>

In [5]: ts.index.fr
ts.index.freq     ts.index.freqstr  

In [5]: ts.index.freq
Out[5]: <10 Days>

In [6]: ts.index.freq = None
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-6-d89557d7f8e5> in <module>()
----> 1 ts.index.freq = None

AttributeError: can't set attribute

In [7]: ts.index.offset = None

In [8]: ts
Out[8]: 
2000-01-01    2.963378
2000-01-11   -0.685998
2000-01-21    0.392812
2000-01-31   -0.143893
2000-02-10   -1.162283
2000-02-20   -0.460511
2000-03-01   -0.751741
2000-03-11   -0.567428
2000-03-21   -0.439105
2000-03-31    0.040322
2000-04-10   -0.929786
2000-04-20   -0.620005
2000-04-30    0.482502
2000-05-10    0.109013
2000-05-20    0.657817
2000-05-30   -0.668386
2000-06-09   -1.797074
2000-06-19   -0.197738
2000-06-29   -0.312481
2000-07-09    1.240477
2000-07-19    0.447583
2000-07-29    0.188429
2000-08-08   -0.117540
2000-08-18   -1.145495
2000-08-28    0.479124
2000-09-07    0.309968
2000-09-17    0.769928
2000-09-27   -0.501629
2000-10-07    0.164322
2000-10-17   -0.554113
2000-10-27    0.468588
2000-11-06    0.857458
2000-11-16    0.508256
2000-11-26   -0.452384
2000-12-06    1.732538
2000-12-16    0.695495
2000-12-26    0.441233
2001-01-05   -0.271561

In [9]: ts.index.offset = None

In [10]: ts.plot()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-10-132f3667ee95> in <module>()
----> 1 ts.plot()

/home/wesm/code/pandas/pandas/tools/plotting.pyc in plot_series(series, label, kind, use_index, rot, xticks, yticks, xlim, ylim, ax, style, grid, logy, **kwds)
    758                      legend=False, grid=grid, label=label, **kwds)
    759 
--> 760     plot_obj.generate()
    761     plot_obj.draw()
    762 

/home/wesm/code/pandas/pandas/tools/plotting.pyc in generate(self)
    239         self._compute_plot_data()
    240         self._setup_subplots()
--> 241         self._make_plot()
    242         self._post_plot_logic()
    243         self._adorn_subplots()

/home/wesm/code/pandas/pandas/tools/plotting.pyc in _make_plot(self)
    426         if self.use_index and self.has_ts_index:
    427             data = self._maybe_convert_index(self.data)
--> 428             self._make_ts_plot(data)
    429         else:
    430             x = self._get_xticks()

/home/wesm/code/pandas/pandas/tools/plotting.pyc in _make_ts_plot(self, data, **kwargs)
    478 
    479             label = com._stringify(self.label)
--> 480             tsplot(data, plotf, ax=ax, label=label, **kwargs)
    481             ax.grid(self.grid)
    482         else:

/home/wesm/code/pandas/pandas/tseries/plotting.pyc in tsplot(series, plotf, *args, **kwargs)
    114     # format args and lot
    115     args = _check_plot_params(series, series.index, freq, *args)
--> 116     plotted = plotf(ax, *args,  **kwargs)
    117 
    118     format_dateaxis(ax, ax.freq)

/home/wesm/code/repos/matplotlib/lib/matplotlib/axes.pyc in plot(self, *args, **kwargs)
   3892         lines = []
   3893 
-> 3894         for line in self._get_lines(*args, **kwargs):
   3895             self.add_line(line)
   3896             lines.append(line)

/home/wesm/code/repos/matplotlib/lib/matplotlib/axes.pyc in _grab_next_args(self, *args, **kwargs)
    321                 return
    322             if len(remaining) <= 3:
--> 323                 for seg in self._plot_args(remaining, kwargs):
    324                     yield seg
    325                 return

/home/wesm/code/repos/matplotlib/lib/matplotlib/axes.pyc in _plot_args(self, tup, kwargs)
    299             x = np.arange(y.shape[0], dtype=float)
    300 
--> 301         x, y = self._xy_from_xy(x, y)
    302 
    303         if self.command == 'plot':

/home/wesm/code/repos/matplotlib/lib/matplotlib/axes.pyc in _xy_from_xy(self, x, y)
    215     def _xy_from_xy(self, x, y):
    216         if self.axes.xaxis is not None and self.axes.yaxis is not None:
--> 217             bx = self.axes.xaxis.update_units(x)
    218             by = self.axes.yaxis.update_units(y)
    219 

/home/wesm/code/repos/matplotlib/lib/matplotlib/axis.pyc in update_units(self, data)
   1276         """
   1277 
-> 1278         converter = munits.registry.get_converter(data)
   1279         if converter is None:
   1280             return False

/home/wesm/code/repos/matplotlib/lib/matplotlib/units.pyc in get_converter(self, x)
    131 
    132         if converter is None and iterable(x):
--> 133             for thisx in x:
    134                 # Make sure that recursing might actually lead to a solution, if
    135                 # we are just going to re-examine another item of the same kind,

/home/wesm/code/pandas/pandas/tseries/period.pyc in __iter__(self)
    685     def __iter__(self):
    686         for val in self.values:
--> 687             yield Period(ordinal=val, freq=self.freq)
    688 
    689     @property

/home/wesm/code/pandas/pandas/tseries/period.pyc in __init__(self, value, freq, ordinal, year, month, quarter, day, hour, minute, second)
    136         base, mult = _gfc(freq)
    137         if mult != 1:
--> 138             raise ValueError('Only mult == 1 supported')
    139 
    140         if self.ordinal is None:

ValueError: Only mult == 1 supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Visualization plotting
Projects
None yet
Development

No branches or pull requests

2 participants