diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index 57985c7..f268ebc 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -63,6 +63,7 @@ class SedimentCalibrationTab(QWidget): self.inv_hc = AcousticInversionMethodHighConcentration() self._setup_icons() + self._setup_attrs() self._setup_widgets() def _path_icon(self, icon): @@ -84,6 +85,10 @@ class SedimentCalibrationTab(QWidget): self.icon_approved = QIcon(self._path_icon("approved.png")) self.icon_no_approved = QIcon(self._path_icon("no_approved.png")) + def _setup_attrs(self): + self.fig_BS = None + self.fig_Mfine = None + self.fig_FCB = None def _setup_widgets(self): self.verticalLayoutMain = QVBoxLayout(self._widget_tab) @@ -1029,6 +1034,10 @@ class SedimentCalibrationTab(QWidget): # --- Plot acoustic data recording --- self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS) self.verticalLayout_groupbox_data_plot.removeWidget(self.canvas_BS) + + if self.fig_BS is not None: + self.fig_BS.clear() + self.fig_BS, self.axis_BS = plt.subplots( nrows=1, ncols=1, sharex=True, sharey=False, layout='constrained' @@ -1392,6 +1401,10 @@ class SedimentCalibrationTab(QWidget): # --- Plot profile of the concentration of the fine sediments --- self.verticalLayout_groupbox_interpolate_plot.removeWidget(self.canvas_Mfine) self.verticalLayout_groupbox_interpolate_plot.removeWidget(self.toolbar_Mfine) + + if self.fig_Mfine is not None: + self.fig_Mfine.clear() + self.fig_Mfine, self.ax_Mfine = plt.subplots(1, 1, layout="constrained") self.canvas_Mfine = FigureCanvas(self.fig_Mfine) self.toolbar_Mfine = NavigationToolBar(self.canvas_Mfine, self) @@ -2325,6 +2338,9 @@ class SedimentCalibrationTab(QWidget): self.verticalLayout_groupbox_FCB_plot.removeWidget(self.canvas_FCB) self.verticalLayout_groupbox_FCB_plot.removeWidget(self.toolbar_FCB) + if self.fig_FCB is not None: + self.fig_FCB.clear() + self.fig_FCB, self.axis_FCB = plt.subplots( nrows=1, ncols=1, layout="constrained" )