Sediement calibration: Clear plots at redraw.

dev
Pierre-Antoine 2025-04-22 11:22:32 +02:00
parent 334390abdb
commit 7d9726fbd6
1 changed files with 16 additions and 0 deletions

View File

@ -63,6 +63,7 @@ class SedimentCalibrationTab(QWidget):
self.inv_hc = AcousticInversionMethodHighConcentration() self.inv_hc = AcousticInversionMethodHighConcentration()
self._setup_icons() self._setup_icons()
self._setup_attrs()
self._setup_widgets() self._setup_widgets()
def _path_icon(self, icon): def _path_icon(self, icon):
@ -84,6 +85,10 @@ class SedimentCalibrationTab(QWidget):
self.icon_approved = QIcon(self._path_icon("approved.png")) self.icon_approved = QIcon(self._path_icon("approved.png"))
self.icon_no_approved = QIcon(self._path_icon("no_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): def _setup_widgets(self):
self.verticalLayoutMain = QVBoxLayout(self._widget_tab) self.verticalLayoutMain = QVBoxLayout(self._widget_tab)
@ -1029,6 +1034,10 @@ class SedimentCalibrationTab(QWidget):
# --- Plot acoustic data recording --- # --- Plot acoustic data recording ---
self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS) self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_data_plot.removeWidget(self.canvas_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( self.fig_BS, self.axis_BS = plt.subplots(
nrows=1, ncols=1, sharex=True, sharey=False, nrows=1, ncols=1, sharex=True, sharey=False,
layout='constrained' layout='constrained'
@ -1392,6 +1401,10 @@ class SedimentCalibrationTab(QWidget):
# --- Plot profile of the concentration of the fine sediments --- # --- 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.canvas_Mfine)
self.verticalLayout_groupbox_interpolate_plot.removeWidget(self.toolbar_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.fig_Mfine, self.ax_Mfine = plt.subplots(1, 1, layout="constrained")
self.canvas_Mfine = FigureCanvas(self.fig_Mfine) self.canvas_Mfine = FigureCanvas(self.fig_Mfine)
self.toolbar_Mfine = NavigationToolBar(self.canvas_Mfine, self) 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.canvas_FCB)
self.verticalLayout_groupbox_FCB_plot.removeWidget(self.toolbar_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( self.fig_FCB, self.axis_FCB = plt.subplots(
nrows=1, ncols=1, layout="constrained" nrows=1, ncols=1, layout="constrained"
) )