Skip to content

Commit

Permalink
DEPR: remove tsplot (pandas-dev#29726)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and proost committed Dec 19, 2019
1 parent 2a66aea commit 2bec505
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 89 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
- Removed the previously deprecated ``IntervalIndex.from_intervals`` in favor of the :class:`IntervalIndex` constructor (:issue:`19263`)
- Changed the default value for the "keep_tz" argument in :meth:`DatetimeIndex.to_series` to ``True`` (:issue:`23739`)
- Ability to read pickles containing :class:`Categorical` instances created with pre-0.16 version of pandas has been removed (:issue:`27538`)
- Removed previously deprecated :func:`pandas.tseries.plotting.tsplot` (:issue:`18627`)
- Removed the previously deprecated ``reduce`` and ``broadcast`` arguments from :meth:`DataFrame.apply` (:issue:`18577`)
- Removed the previously deprecated ``assert_raises_regex`` function in ``pandas.util.testing`` (:issue:`29174`)
- Removed :meth:`Index.is_lexsorted_for_tuple` (:issue:`29305`)
Expand Down
1 change: 0 additions & 1 deletion pandas/plotting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
- hist_series and hist_frame (for `Series.hist` and `DataFrame.hist`)
- boxplot (`pandas.plotting.boxplot(df)` equivalent to `DataFrame.boxplot`)
- boxplot_frame and boxplot_frame_groupby
- tsplot (deprecated)
- register and deregister (register converters for the tick formats)
- Plots not called as `Series` and `DataFrame` methods:
- table
Expand Down
28 changes: 0 additions & 28 deletions pandas/plotting/_misc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from contextlib import contextmanager
import warnings

from pandas.util._decorators import deprecate_kwarg

Expand Down Expand Up @@ -426,33 +425,6 @@ def autocorrelation_plot(series, ax=None, **kwargs):
return plot_backend.autocorrelation_plot(series=series, ax=ax, **kwargs)


def tsplot(series, plotf, ax=None, **kwargs):
"""
Plots a Series on the given Matplotlib axes or the current axes
Parameters
----------
axes : Axes
series : Series
Notes
_____
Supports same kwargs as Axes.plot
.. deprecated:: 0.23.0
Use Series.plot() instead
"""
warnings.warn(
"'tsplot' is deprecated and will be removed in a "
"future version. Please use Series.plot() instead.",
FutureWarning,
stacklevel=2,
)
plot_backend = _get_plot_backend("matplotlib")
return plot_backend.tsplot(series=series, plotf=plotf, ax=ax, **kwargs)


class _Options(dict):
"""
Stores pandas plotting options.
Expand Down
57 changes: 0 additions & 57 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,33 +99,12 @@ def test_nonnumeric_exclude(self):
with pytest.raises(TypeError, match=msg):
df["A"].plot()

def test_tsplot_deprecated(self):
from pandas.tseries.plotting import tsplot

_, ax = self.plt.subplots()
ts = tm.makeTimeSeries()

with tm.assert_produces_warning(FutureWarning):
tsplot(ts, self.plt.Axes.plot, ax=ax)

@pytest.mark.slow
def test_tsplot(self):

from pandas.tseries.plotting import tsplot

_, ax = self.plt.subplots()
ts = tm.makeTimeSeries()

def f(*args, **kwds):
with tm.assert_produces_warning(FutureWarning):
return tsplot(s, self.plt.Axes.plot, *args, **kwds)

for s in self.period_ser:
_check_plot_works(f, s.index.freq, ax=ax, series=s)

for s in self.datetime_ser:
_check_plot_works(f, s.index.freq.rule_code, ax=ax, series=s)

for s in self.period_ser:
_check_plot_works(s.plot, ax=ax)

Expand Down Expand Up @@ -194,17 +173,6 @@ def check_format_of_first_point(ax, expected_string):
check_format_of_first_point(ax, "t = 2014-01-01 y = 1.000000")
tm.close()

# tsplot
from pandas.tseries.plotting import tsplot

_, ax = self.plt.subplots()
with tm.assert_produces_warning(FutureWarning):
tsplot(annual, self.plt.Axes.plot, ax=ax)
check_format_of_first_point(ax, "t = 2014 y = 1.000000")
with tm.assert_produces_warning(FutureWarning):
tsplot(daily, self.plt.Axes.plot, ax=ax)
check_format_of_first_point(ax, "t = 2014-01-01 y = 1.000000")

@pytest.mark.slow
def test_line_plot_period_series(self):
for s in self.period_ser:
Expand Down Expand Up @@ -892,16 +860,6 @@ def test_to_weekly_resampling(self):
for l in ax.get_lines():
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq

_, ax = self.plt.subplots()
from pandas.tseries.plotting import tsplot

with tm.assert_produces_warning(FutureWarning):
tsplot(high, self.plt.Axes.plot, ax=ax)
with tm.assert_produces_warning(FutureWarning):
lines = tsplot(low, self.plt.Axes.plot, ax=ax)
for l in lines:
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq

@pytest.mark.slow
def test_from_weekly_resampling(self):
idxh = date_range("1/1/1999", periods=52, freq="W")
Expand All @@ -926,21 +884,6 @@ def test_from_weekly_resampling(self):
tm.assert_numpy_array_equal(xdata, expected_h)
tm.close()

_, ax = self.plt.subplots()
from pandas.tseries.plotting import tsplot

with tm.assert_produces_warning(FutureWarning):
tsplot(low, self.plt.Axes.plot, ax=ax)
with tm.assert_produces_warning(FutureWarning):
lines = tsplot(high, self.plt.Axes.plot, ax=ax)
for l in lines:
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq
xdata = l.get_xdata(orig=False)
if len(xdata) == 12: # idxl lines
tm.assert_numpy_array_equal(xdata, expected_l)
else:
tm.assert_numpy_array_equal(xdata, expected_h)

@pytest.mark.slow
def test_from_resampling_area_line_mixed(self):
idxh = date_range("1/1/1999", periods=52, freq="W")
Expand Down
3 changes: 0 additions & 3 deletions pandas/tseries/plotting.py

This file was deleted.

0 comments on commit 2bec505

Please sign in to comment.