File tree 3 files changed +9
-4
lines changed
3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ pandas 0.11.1
127
127
when ``parse_dates `` is specified (GH3062 _)
128
128
- Fix not consolidating before to_csv (GH3624 _)
129
129
- Fix alignment issue when setitem in a DataFrame with a piece of a DataFrame (GH3626 _)
130
+ - Fix plotting of unordered DatetimeIndex (GH3601 _)
130
131
131
132
.. _GH3164 : https://github.com/pydata/pandas/issues/3164
132
133
.. _GH2786 : https://github.com/pydata/pandas/issues/2786
@@ -180,6 +181,7 @@ pandas 0.11.1
180
181
.. _GH3062 : https://github.com/pydata/pandas/issues/3062
181
182
.. _GH3624 : https://github.com/pydata/pandas/issues/3624
182
183
.. _GH3626 : https://github.com/pydata/pandas/issues/3626
184
+ .. _GH3601 : https://github.com/pydata/pandas/issues/3601
183
185
.. _GH1512 : https://github.com/pydata/pandas/issues/1512
184
186
185
187
Original file line number Diff line number Diff line change @@ -677,14 +677,16 @@ def test_default_color_cycle(self):
677
677
678
678
@slow
679
679
def test_unordered_ts (self ):
680
- df = DataFrame (np .random . randn ( 3 , 1 ),
680
+ df = DataFrame (np .array ([ 3.0 , 2.0 , 1.0 ] ),
681
681
index = [date (2012 , 10 , 1 ),
682
682
date (2012 , 9 , 1 ),
683
683
date (2012 , 8 , 1 )],
684
684
columns = ['test' ])
685
685
ax = df .plot ()
686
686
xticks = ax .lines [0 ].get_xdata ()
687
687
self .assert_ (xticks [0 ] < xticks [1 ])
688
+ ydata = ax .lines [0 ].get_ydata ()
689
+ self .assert_ (np .all (ydata == np .array ([1.0 , 2.0 , 3.0 ])))
688
690
689
691
class TestDataFrameGroupByPlots (unittest .TestCase ):
690
692
Original file line number Diff line number Diff line change @@ -947,8 +947,8 @@ def _get_xticks(self, convert_period=False):
947
947
948
948
if self .use_index :
949
949
if convert_period and isinstance (index , PeriodIndex ):
950
- index = index . to_timestamp () .order ()
951
- x = index ._mpl_repr ()
950
+ self . data = self . data . reindex ( index = index .order () )
951
+ x = self . data . index . to_timestamp () ._mpl_repr ()
952
952
elif index .is_numeric ():
953
953
"""
954
954
Matplotlib supports numeric values or datetime objects as
@@ -958,7 +958,8 @@ def _get_xticks(self, convert_period=False):
958
958
"""
959
959
x = index ._mpl_repr ()
960
960
elif is_datetype :
961
- x = index .order ()._mpl_repr ()
961
+ self .data = self .data .reindex (index = index .order ())
962
+ x = self .data .index ._mpl_repr ()
962
963
else :
963
964
self ._need_to_set_index = True
964
965
x = range (len (index ))
You can’t perform that action at this time.
0 commit comments