[plot] addTabbedDockWidget do not manage removed docks
This API stores docks inside `_dockWidgets`, but i see nowhere a function to clean up this list.

As result we can add docks, but we can't remove them.

I use to create ROI docks that i destroy. At the second call, the layout is broken, cause the code tries to tabbify the new one, on the previous one which not anymore own by the plot, or whatever.
diff --git a/silx/gui/plot/PlotWindow.py b/silx/gui/plot/PlotWindow.py
index 069dbc60d..a6abb3798 100644
--- a/silx/gui/plot/PlotWindow.py
+++ b/silx/gui/plot/PlotWindow.py
@@ -464,7 +464,7 @@ class PlotWindow(PlotWidget):
         """Add a dock widget as a new tab if there are already dock widgets
         in the plot. When the first tab is added, the area is chosen
         depending on the plot geometry:
-        it the window is much wider than it is high, the right dock area
+        if the window is much wider than it is high, the right dock area
         is used, else the bottom dock area is used.
 
         :param dock_widget: Instance of :class:`QDockWidget` to be added.
@@ -485,6 +485,17 @@ class PlotWindow(PlotWidget):
             self.tabifyDockWidget(self._dockWidgets[0],
                                   dock_widget)
 
+    def removeDockWidget(self, dockwidget):
+        """Removes the *dockwidget* from the main window layout and hides it.
+
+        Note that the *dockwidget* is *not* deleted.
+
+        :param QDockWidget dockwidget:
+        """
+        if dockwidget in self._dockWidgets:
+            self._dockWidgets.remove(dockwidget)
+        super(PlotWindow, self).removeDockWidget(dockwidget)
+
     def __handleFirstDockWidgetShow(self, visible):
         """Handle QDockWidget.visibilityChanged
 
diff --git a/silx/gui/plot/test/testPlotWindow.py b/silx/gui/plot/test/testPlotWindow.py
index a8d83de7a..8e7b35cdc 100644
--- a/silx/gui/plot/test/testPlotWindow.py
+++ b/silx/gui/plot/test/testPlotWindow.py
@@ -86,6 +86,29 @@ class TestPlotWindow(TestCaseQt):
         self.assertIsNot(toolButton, None)
         self.mouseClick(toolButton, qt.Qt.LeftButton)
 
+    def testDockWidgets(self):
+        """Test add/remove dock widgets"""
+        dock1 = qt.QDockWidget('Test 1')
+        dock1.setWidget(qt.QLabel('Test 1'))
+
+        self.plot.addTabbedDockWidget(dock1)
+        self.qapp.processEvents()
+
+        self.plot.removeDockWidget(dock1)
+        self.qapp.processEvents()
+
+        dock2 = qt.QDockWidget('Test 2')
+        dock2.setWidget(qt.QLabel('Test 2'))
+
+        self.plot.addTabbedDockWidget(dock2)
+        self.qapp.processEvents()
+
+        if qt.BINDING != 'PySide2':
+            # Weird bug with PySide2 later upon gc.collect() when getting the layout
+            self.assertNotEqual(self.plot.layout().indexOf(dock2),
+                                -1,
+                                "dock2 not properly displayed")
+
     def testToolAspectRatio(self):
         self.plot.toolBar()
         self.plot.keepDataAspectRatioButton.keepDataAspectRatio()
['silx/gui/plot/PlotWindow.py', 'silx/gui/plot/test/testPlotWindow.py']