Repository: pandas-dev/pandas

Issue:
CLN: deprecate/remove the pandas.tseries.plotting.tsplot function
xref https://github.com/pandas-dev/pandas/pull/17814

As far as I can see, the `tsplot` function (https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/_timeseries.py#L23) is not used internally, and it is not exposed in the `pandas.plotting` namespace (it *is* still exposed in `pandas.tseries.plotting`). 
And I also don't think it is actually a useful function for users? (they would just do `ts.plot()`, and here you have to awkwardly provide an actual plotting function)


Discussion:
i would like to take up this issue. can i??
@starlord1311 Yes, sure!
@jorisvandenbossche can you tell what i am supposed to do?
You need to add a deprecation warning to the tsplot function, see eg https://github.com/pandas-dev/pandas/pull/18258
But can ts.plot use err_style? This is why I use this function, to show replicates.
@r-velde can you show a code example?
```
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

df = pd.read_excel('TimeSeries1.xlsx', sheetname='Sheet1')

ax=sns.tsplot(time="Time (Weeks)",condition="Group",unit="Well",value="Area",data=df,err_style="unit_traces")
```
With the following data in excel:


Group | Well | Time | Area | Time (Weeks)
96 | 1 | 0 | 1.447972 | 0
96 | 1 | 2.066667 | 1.385389 | 0.012302
96 | 1 | 6 | 1.557112 | 0.035714
96 | 1 | 12 | 1.619833 | 0.071429
96 | 1 | 18 | 1.784649 | 0.107143
96 | 1 | 24 | 1.882875 | 0.142857
96 | 1 | 30 | 1.973433 | 0.178571
96 | 1 | 36 | 2.224801 | 0.214286
96 | 1 | 42 | 2.567142 | 0.25
96 | 1 | 48 | 2.944919 | 0.285714
96 | 1 | 54 | 3.120924 | 0.321429
96 | 1 | 60 | 3.598447 | 0.357143
96 | 1 | 66 | 3.944035 | 0.392857
96 | 1 | 72 | 4.473848 | 0.428571
96 | 1 | 78 | 4.870275 | 0.464286
96 | 1 | 84 | 5.629766 | 0.5
96 | 1 | 90 | 6.299804 | 0.535714
96 | 1 | 96 | 6.983381 | 0.571429
96 | 1 | 102 | 7.955833 | 0.607143
96 | 1 | 108 | 8.270613 | 0.642857
96 | 1 | 114 | 8.913711 | 0.678571
96 | 2 | 0 | 1.53632 | 0
96 | 2 | 2.066667 | 1.506894 | 0.012302
96 | 2 | 6 | 1.650917 | 0.035714
96 | 2 | 12 | 1.733463 | 0.071429
96 | 2 | 18 | 2.00811 | 0.107143
96 | 2 | 24 | 2.060676 | 0.142857
96 | 2 | 30 | 2.231156 | 0.178571
96 | 2 | 36 | 2.530601 | 0.214286
96 | 2 | 42 | 2.90223 | 0.25
96 | 2 | 48 | 3.294374 | 0.285714
96 | 2 | 54 | 3.632709 | 0.321429
96 | 2 | 60 | 4.240164 | 0.357143
96 | 2 | 66 | 4.674652 | 0.392857
96 | 2 | 72 | 5.282797 | 0.428571
96 | 2 | 78 | 5.963542 | 0.464286
96 | 2 | 84 | 6.635168 | 0.5
96 | 2 | 90 | 7.489432 | 0.535714
96 | 2 | 96 | 8.36504 | 0.571429
96 | 2 | 102 | 9.27712 | 0.607143
96 | 2 | 108 | 9.850797 | 0.642857
96 | 2 | 114 | 10.6833 | 0.678571


@r-velde this is `tsplot` from seaborn you show, not from pandas, so this issue will not impact you!
@jorisvandenbossche Okay thanks. 

Resolving patch:
diff --git a/pandas/plotting/_timeseries.py b/pandas/plotting/_timeseries.py
--- a/pandas/plotting/_timeseries.py
+++ b/pandas/plotting/_timeseries.py
@@ -23,6 +23,7 @@
 
 
 def tsplot(series, plotf, ax=None, **kwargs):
+    import warnings
     """
     Plots a Series on the given Matplotlib axes or the current axes
 
@@ -35,7 +36,14 @@ def tsplot(series, plotf, ax=None, **kwargs):
     _____
     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)
+
     # Used inferred freq is possible, need a test case for inferred
     if ax is None:
         import matplotlib.pyplot as plt


Test patch:
diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py
--- a/pandas/tests/plotting/test_datetimelike.py
+++ b/pandas/tests/plotting/test_datetimelike.py
@@ -100,6 +100,15 @@ def test_nonnumeric_exclude(self):
 
         pytest.raises(TypeError, 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