diff --git a/doc/source/release.rst b/doc/source/release.rst index 91bf6084e0faa..975d92cc215c4 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -450,8 +450,9 @@ Bug Fixes - Bug in enabling ``subplots=True`` in ``DataFrame.plot`` only has single column raises ``TypeError``, and ``Series.plot`` raises ``AttributeError`` (:issue:`6951`) - Bug in ``DataFrame.plot`` draws unnecessary axes when enabling ``subplots`` and ``kind=scatter`` (:issue:`6951`) - Bug in ``read_csv`` from a filesystem with non-utf-8 encoding (:issue:`6807`) -- Bug in ``iloc`` when setting / aligning (:issue:``6766`) +- Bug in ``iloc`` when setting / aligning (:issue:`6766`) - Bug causing UnicodeEncodeError when get_dummies called with unicode values and a prefix (:issue:`6885`) +- Bug in timeseries-with-frequency plot cursor display (:issue:`5453`) pandas 0.13.1 ------------- diff --git a/pandas/tseries/plotting.py b/pandas/tseries/plotting.py index ae32367a57cd3..abec1d469114f 100644 --- a/pandas/tseries/plotting.py +++ b/pandas/tseries/plotting.py @@ -83,8 +83,7 @@ def tsplot(series, plotf, **kwargs): ax.set_xlim(left, right) # x and y coord info - tz = series.index.to_datetime().tz - ax.format_coord = lambda t, y : "t = {} y = {:8f}".format(datetime.fromtimestamp(t, tz), y) + ax.format_coord = lambda t, y: "t = {} y = {:8f}".format(Period(ordinal=int(t), freq=ax.freq), y) return lines diff --git a/pandas/tseries/tests/test_plotting.py b/pandas/tseries/tests/test_plotting.py index 118c09ddf826f..5d1e4b67041f7 100644 --- a/pandas/tseries/tests/test_plotting.py +++ b/pandas/tseries/tests/test_plotting.py @@ -131,6 +131,21 @@ def test_get_datevalue(self): self.assertEqual(get_datevalue('1/1/1987', 'D'), Period('1987-1-1', 'D').ordinal) + @slow + def test_ts_plot_format_coord(self): + def check_format_of_first_point(ax, expected_string): + first_line = ax.get_lines()[0] + first_x = first_line.get_xdata()[0].ordinal + first_y = first_line.get_ydata()[0] + self.assertEqual(expected_string, ax.format_coord(first_x, first_y)) + + annual = Series(1, index=date_range('2014-01-01', periods=3, freq='A-DEC')) + check_format_of_first_point(annual.plot(), 't = 2014 y = 1.000000') + + # note this is added to the annual plot already in existence, and changes its freq field + daily = Series(1, index=date_range('2014-01-01', periods=3, freq='D')) + check_format_of_first_point(daily.plot(), 't = 2014-01-01 y = 1.000000') + @slow def test_line_plot_period_series(self): for s in self.period_ser: