diff --git a/pandas/core/generic.py b/pandas/core/generic.py index ad56ea44a0dc6..1a9a9a4d8b67f 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3017,6 +3017,10 @@ def _get_numeric_data(self): def _get_bool_data(self): return self._constructor(self._data.get_bool_data()).__finalize__(self) + def _get_datetime_data(self): + return self._constructor( + self._data.get_datetime_data()).__finalize__(self) + # ---------------------------------------------------------------------- # Internal Interface Methods diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 57361886eab8c..59014727ae188 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -3354,6 +3354,16 @@ def get_numeric_data(self, copy=False): self._consolidate_inplace() return self.combine([b for b in self.blocks if b.is_numeric], copy) + def get_datetime_data(self, copy=False): + """ + Parameters + ---------- + copy : boolean, default False + Whether to copy the blocks + """ + self._consolidate_inplace() + return self.combine([b for b in self.blocks if b.is_datetime], copy) + def combine(self, blocks, copy=True): """ return a new manager with the blocks """ if len(blocks) == 0: diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index f70a2b0b22140..adef4b725c459 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -1579,8 +1579,11 @@ class PlanePlot(MPLPlot): _layout_type = 'single' - def __init__(self, data, x, y, **kwargs): - MPLPlot.__init__(self, data, **kwargs) + def __init__(self, data, x, y, sharex=False, **kwargs): + if sharex is None: + # Fix x axis color bar problems + sharex = False + MPLPlot.__init__(self, data, sharex=sharex, **kwargs) if x is None or y is None: raise ValueError(self._kind + ' requires and x and y column') if is_integer(x) and not self.data.columns.holds_integer(): @@ -1613,6 +1616,31 @@ def __init__(self, data, x, y, s=None, c=None, **kwargs): c = self.data.columns[c] self.c = c + def _compute_plot_data(self): + data = self.data + + if isinstance(data, Series): + label = self.label + if label is None and data.name is None: + label = 'None' + data = data.to_frame(name=label) + + numeric_dt__data = data._convert(datetime=True)._get_numeric_data() + time_data = data._convert(datetime=True)._get_datetime_data() + numeric_dt__data = numeric_dt__data.join(time_data) + + try: + is_empty = numeric_dt__data.empty + except AttributeError: + is_empty = not len(numeric_dt__data) + + # no empty frames or series allowed + if is_empty: + raise TypeError('Empty {0!r}: no numeric data to ' + 'plot'.format(numeric_dt__data.__class__.__name__)) + + self.data = numeric_dt__data + def _make_plot(self): x, y, c, data = self.x, self.y, self.c, self.data ax = self.axes[0]