From c3dc14d5d4929b6fdb90c43d5e534ce44a4a8501 Mon Sep 17 00:00:00 2001 From: Fadi <fadi.gattoussi@stud.th-deg.de> Date: Mon, 25 Dec 2023 21:13:29 +0100 Subject: [PATCH] plots completed --- Main.py | 25 +++++++++++++++++++------ README.md | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Main.py b/Main.py index e8aa4e7..2767e43 100644 --- a/Main.py +++ b/Main.py @@ -78,10 +78,10 @@ class MainWindow(QMainWindow): self.GUI_selections = {} # create new graphs self.scatt = MplCanvas(self, width=6, height=5, dpi=100) - self.scatt.axes.set_title("Carats vs Price") - self.scatt.axes.scatter(diamonds['carat'], diamonds['price'], color='red', s=2) - # self.scatt.axes.scatter(self.GUI_selections['carat'], self.price, color='blue', s=50) - + # self.scatt.axes.set_title("Carats vs Price") + # self.scatt.axes.scatter(diamonds['carat'], diamonds['price'], color='red', s=2, label='carat') + # self.scatt.axes.scatter(self.GUI_selections['carat'], self.price, color='blue', s=50, label='expected') + # Create labels and input fields self.input_fields = [QComboBox(self), QComboBox(self), QComboBox(self), QLineEdit(self), QLineEdit(self), QLineEdit(self), QLineEdit(self), QLineEdit(self), @@ -113,6 +113,7 @@ class MainWindow(QMainWindow): self.setWindowTitle('Assistance Systems') self.show() + def disable_input_field(self, field_name): for key, value in self.menu_items.items(): if value == field_name: @@ -148,7 +149,19 @@ class MainWindow(QMainWindow): self.price = model.predict_price(X_test) # price = model.predict(X_test)[0] self.display_price.setText(str(self.price)) - self.update_graph() + self.create_graph() + + def create_graph(self): + self.scatt.axes.clear() + + self.scatt.axes.set_title("Carats vs Price") + self.scatt.axes.scatter(diamonds['carat'], diamonds['price'], color='red', s=2, label='carat') + self.scatt.axes.scatter(self.GUI_selections['carat'], self.price, color='blue', s=50, label='expected') + # self.scatt.axes.axhline(y=self.price, color='blue', linestyle='--', label='Predicted Price') + # self.scatt.axes.axhline(x=self.GUI_selections['carat'], color='blue', linestyle='--', label='carat') + # self.scatt.legend() + print("I am error") + self.scatt.draw() def validate_inputs(self, val, attribute): if Advanced.Advanced_selections[attribute]: @@ -291,4 +304,4 @@ app = QApplication(sys.argv) window = MyTabs() window.show() -app.exec() \ No newline at end of file +app.exec() diff --git a/README.md b/README.md index 17d66c0..1739f3c 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ pip install -r requirements.txt - `diamonds.csv`: Dataset containing diamond attributes. - `Main.py`: Main Python script with GUI for prediction and visualization. - `requirements.txt`: List of Python packages required for the project. -- `training3.ipynb`: Jupyter notebook for data preprocessing and analysis. +- `training.ipynb`: Jupyter notebook for data preprocessing and analysis. ## Contributing Feel free to contribute to this project by submitting pull requests or suggesting improvements. -- GitLab