Skip to content

Commit 142c8ff

Browse files
jbrockmendelproost
authored andcommitted
DEPR: remove tsplot (pandas-dev#29726)
1 parent 23f7566 commit 142c8ff

File tree

5 files changed

+1
-89
lines changed

5 files changed

+1
-89
lines changed

doc/source/whatsnew/v1.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
318318
- Removed the previously deprecated ``IntervalIndex.from_intervals`` in favor of the :class:`IntervalIndex` constructor (:issue:`19263`)
319319
- Changed the default value for the "keep_tz" argument in :meth:`DatetimeIndex.to_series` to ``True`` (:issue:`23739`)
320320
- Ability to read pickles containing :class:`Categorical` instances created with pre-0.16 version of pandas has been removed (:issue:`27538`)
321+
- Removed previously deprecated :func:`pandas.tseries.plotting.tsplot` (:issue:`18627`)
321322
- Removed the previously deprecated ``reduce`` and ``broadcast`` arguments from :meth:`DataFrame.apply` (:issue:`18577`)
322323
- Removed the previously deprecated ``assert_raises_regex`` function in ``pandas.util.testing`` (:issue:`29174`)
323324
- Removed :meth:`Index.is_lexsorted_for_tuple` (:issue:`29305`)

pandas/plotting/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
- hist_series and hist_frame (for `Series.hist` and `DataFrame.hist`)
3939
- boxplot (`pandas.plotting.boxplot(df)` equivalent to `DataFrame.boxplot`)
4040
- boxplot_frame and boxplot_frame_groupby
41-
- tsplot (deprecated)
4241
- register and deregister (register converters for the tick formats)
4342
- Plots not called as `Series` and `DataFrame` methods:
4443
- table

pandas/plotting/_misc.py

-28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from contextlib import contextmanager
2-
import warnings
32

43
from pandas.util._decorators import deprecate_kwarg
54

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

428427

429-
def tsplot(series, plotf, ax=None, **kwargs):
430-
"""
431-
Plots a Series on the given Matplotlib axes or the current axes
432-
433-
Parameters
434-
----------
435-
axes : Axes
436-
series : Series
437-
438-
Notes
439-
_____
440-
Supports same kwargs as Axes.plot
441-
442-
443-
.. deprecated:: 0.23.0
444-
Use Series.plot() instead
445-
"""
446-
warnings.warn(
447-
"'tsplot' is deprecated and will be removed in a "
448-
"future version. Please use Series.plot() instead.",
449-
FutureWarning,
450-
stacklevel=2,
451-
)
452-
plot_backend = _get_plot_backend("matplotlib")
453-
return plot_backend.tsplot(series=series, plotf=plotf, ax=ax, **kwargs)
454-
455-
456428
class _Options(dict):
457429
"""
458430
Stores pandas plotting options.

pandas/tests/plotting/test_datetimelike.py

-57
Original file line numberDiff line numberDiff line change
@@ -99,33 +99,12 @@ def test_nonnumeric_exclude(self):
9999
with pytest.raises(TypeError, match=msg):
100100
df["A"].plot()
101101

102-
def test_tsplot_deprecated(self):
103-
from pandas.tseries.plotting import tsplot
104-
105-
_, ax = self.plt.subplots()
106-
ts = tm.makeTimeSeries()
107-
108-
with tm.assert_produces_warning(FutureWarning):
109-
tsplot(ts, self.plt.Axes.plot, ax=ax)
110-
111102
@pytest.mark.slow
112103
def test_tsplot(self):
113104

114-
from pandas.tseries.plotting import tsplot
115-
116105
_, ax = self.plt.subplots()
117106
ts = tm.makeTimeSeries()
118107

119-
def f(*args, **kwds):
120-
with tm.assert_produces_warning(FutureWarning):
121-
return tsplot(s, self.plt.Axes.plot, *args, **kwds)
122-
123-
for s in self.period_ser:
124-
_check_plot_works(f, s.index.freq, ax=ax, series=s)
125-
126-
for s in self.datetime_ser:
127-
_check_plot_works(f, s.index.freq.rule_code, ax=ax, series=s)
128-
129108
for s in self.period_ser:
130109
_check_plot_works(s.plot, ax=ax)
131110

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

197-
# tsplot
198-
from pandas.tseries.plotting import tsplot
199-
200-
_, ax = self.plt.subplots()
201-
with tm.assert_produces_warning(FutureWarning):
202-
tsplot(annual, self.plt.Axes.plot, ax=ax)
203-
check_format_of_first_point(ax, "t = 2014 y = 1.000000")
204-
with tm.assert_produces_warning(FutureWarning):
205-
tsplot(daily, self.plt.Axes.plot, ax=ax)
206-
check_format_of_first_point(ax, "t = 2014-01-01 y = 1.000000")
207-
208176
@pytest.mark.slow
209177
def test_line_plot_period_series(self):
210178
for s in self.period_ser:
@@ -892,16 +860,6 @@ def test_to_weekly_resampling(self):
892860
for l in ax.get_lines():
893861
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq
894862

895-
_, ax = self.plt.subplots()
896-
from pandas.tseries.plotting import tsplot
897-
898-
with tm.assert_produces_warning(FutureWarning):
899-
tsplot(high, self.plt.Axes.plot, ax=ax)
900-
with tm.assert_produces_warning(FutureWarning):
901-
lines = tsplot(low, self.plt.Axes.plot, ax=ax)
902-
for l in lines:
903-
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq
904-
905863
@pytest.mark.slow
906864
def test_from_weekly_resampling(self):
907865
idxh = date_range("1/1/1999", periods=52, freq="W")
@@ -926,21 +884,6 @@ def test_from_weekly_resampling(self):
926884
tm.assert_numpy_array_equal(xdata, expected_h)
927885
tm.close()
928886

929-
_, ax = self.plt.subplots()
930-
from pandas.tseries.plotting import tsplot
931-
932-
with tm.assert_produces_warning(FutureWarning):
933-
tsplot(low, self.plt.Axes.plot, ax=ax)
934-
with tm.assert_produces_warning(FutureWarning):
935-
lines = tsplot(high, self.plt.Axes.plot, ax=ax)
936-
for l in lines:
937-
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq
938-
xdata = l.get_xdata(orig=False)
939-
if len(xdata) == 12: # idxl lines
940-
tm.assert_numpy_array_equal(xdata, expected_l)
941-
else:
942-
tm.assert_numpy_array_equal(xdata, expected_h)
943-
944887
@pytest.mark.slow
945888
def test_from_resampling_area_line_mixed(self):
946889
idxh = date_range("1/1/1999", periods=52, freq="W")

pandas/tseries/plotting.py

-3
This file was deleted.

0 commit comments

Comments
 (0)