diff --git a/Main.py b/Main.py index e8aa4e71a9fd3ef90cf45fcae50c07ce45e84ef5..2767e435e78037c8fda56c3b92b40277aeb45f48 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 17d66c061378d8811eb0a2de96394c36a6ececeb..1739f3cb0ed459328bc1383b639da70e70572add 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.