sample are plotted with different colors when fine and sand file are downloaded

dev-brahim
brahim 2025-03-26 12:03:19 +01:00
parent a8bb150bf8
commit a7aba734a3
1 changed files with 23 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import pandas as pd
import itertools
import matplotlib.pyplot as plt
# from QtCore.QByteArray import length
from matplotlib.colors import LogNorm, BASE_COLORS
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
@ -189,6 +190,9 @@ class SampleDataTab(QWidget):
self.combobox_x_axis = QComboBox()
self.combobox_x_axis.addItems(['Concentration (g/L)', 'Concentration (%)'])
self.combobox_x_axis.setItemData(1,
"FINE : 100 * Cfine / (Cfine + Csand) | SAND : 100 * Csand / (Cfine + Csand)"
, Qt.ToolTipRole)
self.gridLayout_groupbox_option_total_concentration_plot.addWidget(self.combobox_x_axis, 0, 1)
self.label_y_axis = QLabel()
@ -246,6 +250,9 @@ class SampleDataTab(QWidget):
self.pushbutton_plot_transect.clicked.connect(self.fill_comboboxes_and_plot_transect)
self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration)
self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration)
self.combobox_PSD_plot.currentTextChanged.connect(self.plot_PSD_fine_and_sand_sediments)
# -------------------- Functions for Sample Data Tab --------------------
@ -424,6 +431,8 @@ class SampleDataTab(QWidget):
i, 0, self.comboBox_sample_table_fine[i]
)
self.comboBox_sample_table_fine[i].setCurrentIndex(i % len(list(color_list.keys())))
self.comboBox_sample_table_fine[i]\
.currentTextChanged\
.connect(self.plot_total_concentration)
@ -469,8 +478,8 @@ class SampleDataTab(QWidget):
self.tableWidget_fine.itemChanged.connect(self.plot_total_concentration)
self.tableWidget_fine.itemChanged.connect(self.plot_PSD_fine_and_sand_sediments)
self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration)
self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration)
# self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration)
# self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration)
self.plot_sample_position_on_transect()
self.plot_total_concentration()
@ -521,6 +530,8 @@ class SampleDataTab(QWidget):
i, 0, self.comboBox_sample_table_sand[i]
)
self.comboBox_sample_table_sand[i].setCurrentIndex(i % len(list(color_list.keys())))
self.comboBox_sample_table_sand[i]\
.currentTextChanged\
.connect(self.plot_total_concentration)
@ -1367,6 +1378,11 @@ class SampleDataTab(QWidget):
else:
self.tableWidget_fine.blockSignals(True)
self.tableWidget_sand.blockSignals(True)
self.combobox_x_axis.blockSignals(True)
self.combobox_y_axis.blockSignals(True)
self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.canvas_plot_total_concentration)
self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.toolbar_plot_total_concentration)
@ -1632,6 +1648,11 @@ class SampleDataTab(QWidget):
self.axis_total_concentration.legend(loc="upper right")
self.figure_total_concentration.canvas.draw_idle()
self.tableWidget_fine.blockSignals(False)
self.tableWidget_sand.blockSignals(False)
self.combobox_x_axis.blockSignals(False)
self.combobox_y_axis.blockSignals(False)
def plot_PSD_fine_and_sand_sediments(self):
""" Update the plot of Particle Size Distribution according to choices of x-axis and y-axis combo-boxes """