Repository: sktime/sktime

Issue:
[BUG] plot_series inconsistent date/time index 
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->

**To Reproduce**

```python
y = load_airline()
y = y[:48]
fh=np.arange(1, 13)

y_train, y_test = temporal_train_test_split(y, test_size=len(fh))
plot_series(y_train, y_test, labels=["y_train", "y_test"]);
print(y.shape, y_train.shape[0], y_test.shape[0])
print(y.index)
```

> (48,) 36 12
> PeriodIndex(['1949-01', '1949-02', '1949-03', '1949-04', '1949-05', '1949-06',
>              '1949-07', '1949-08', '1949-09', '1949-10', '1949-11', '1949-12',
>              '1950-01', '1950-02', '1950-03', '1950-04', '1950-05', '1950-06',
>              '1950-07', '1950-08', '1950-09', '1950-10', '1950-11', '1950-12',
>              '1951-01', '1951-02', '1951-03', '1951-04', '1951-05', '1951-06',
>              '1951-07', '1951-08', '1951-09', '1951-10', '1951-11', '1951-12',
>              '1952-01', '1952-02', '1952-03', '1952-04', '1952-05', '1952-06',
>              '1952-07', '1952-08', '1952-09', '1952-10', '1952-11', '1952-12'],
>             dtype='period[M]', name='Period', freq='M')
> 

**Expected behavior**
The X-axis should go till end of 1952. The X-axis on the plot does not reflect the indices correctly. It should go till 1952, but shows values only till 1949

![image](https://user-images.githubusercontent.com/33585645/100865855-800ef980-345d-11eb-9980-476454e8de68.png)

**Versions**
System:
    python: 3.6.12 |Anaconda, Inc.| (default, Sep  9 2020, 00:29:25) [MSC v.1916 64 bit (AMD64)]
executable: C:\Users\xxxx\AppData\Local\Continuum\anaconda3\envs\sktime\python.exe
   machine: Windows-10-10.0.18362-SP0

Python dependencies:
          pip: 20.3
   setuptools: 49.6.0
      sklearn: 0.23.2
        numpy: 1.19.2
        scipy: 1.5.2
       Cython: 0.29.17
       pandas: 1.1.3
   matplotlib: 3.3.2
       joblib: 0.17.0
        numba: None
     pmdarima: 1.7.1
      tsfresh: None




Discussion:
Thanks for raising the issue @ngupta23 - looks like internally something goes wrong when merging the indices from `y_train` and `y_test`. 
I can try to fix this!
@gracewgao that would be awesome! I noticed that integer indices also seem a bit off. Let me know if you need any help.

Resolving patch:
diff --git a/sktime/utils/plotting/__init__.py b/sktime/utils/plotting/__init__.py
--- a/sktime/utils/plotting/__init__.py
+++ b/sktime/utils/plotting/__init__.py
@@ -5,8 +5,6 @@
 __all__ = ["plot_series"]
 __author__ = ["Markus Löning"]
 
-import warnings
-
 import numpy as np
 
 from sktime.utils.check_imports import _check_soft_dependencies
@@ -30,6 +28,8 @@ def plot_series(*series, labels=None):
     """
     _check_soft_dependencies("matplotlib", "seaborn")
     import matplotlib.pyplot as plt
+    from matplotlib.ticker import FuncFormatter, MaxNLocator
+    from matplotlib.cbook import flatten
     import seaborn as sns
 
     n_series = len(series)
@@ -75,10 +75,19 @@ def plot_series(*series, labels=None):
 
         plot_func(x=x, y=y, ax=ax, marker="o", label=label, color=color)
 
-    # set combined index as xticklabels, suppress matplotlib warning
-    with warnings.catch_warnings():
-        warnings.filterwarnings("ignore")
-        ax.set(xticklabels=index)
+    # combine data points for all series
+    xs_flat = list(flatten(xs))
+
+    # set x label of data point to the matching index
+    def format_fn(tick_val, tick_pos):
+        if int(tick_val) in xs_flat:
+            return index[int(tick_val)]
+        else:
+            return ""
+
+    # dynamically set x label ticks and spacing from index labels
+    ax.xaxis.set_major_formatter(FuncFormatter(format_fn))
+    ax.xaxis.set_major_locator(MaxNLocator(integer=True))
 
     if legend:
         ax.legend()


Test patch: