Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 2.05 KB

File metadata and controls

69 lines (49 loc) · 2.05 KB

Machine Learning Charts Project

This project contains Python scripts to generate various types of charts (Bar, Histogram, Line, Pie, Scatter) using matplotlib.

📦 Prerequisites

  • Python 3.x
  • PIP (Python Package Installer)

🚀 Setup

  1. Open the project folder in your terminal or VS Code.
  2. Activate the Virtual Environment:
    • Windows (PowerShell):
      .\.venv\Scripts\activate
    • Mac/Linux:
      source .venv/bin/activate
  3. Install Requirements (if not already installed):
    pip install -r Requirements.txt

▶️ Running the Scripts Correctly

Option 1: Using the Terminal (Recommended)

Always run the scripts using the Python interpreter from your virtual environment:

.\.venv\Scripts\python.exe <script_name>.py

Example:

.\.venv\Scripts\python.exe histogram_chart.py

Option 2: Using the "Run" Button in VS Code

If you click the Run button and images are not saving, VS Code is likely using the wrong Python interpreter.

To fix this:

  1. Press Ctrl + Shift + P within VS Code.
  2. Type and select Python: Select Interpreter.
  3. Choose the option that says ('.venv': venv) or looks like .\.venv\Scripts\python.exe.
  4. Now, the "Run" button will work correctly!

❓ Troubleshooting

Issue: The script runs but no image is saved.

  • Cause: You are likely running the script with a global Python installation that doesn't have matplotlib installed.
  • Fix: Follow the instructions above to use the .venv environment.
  • Note: If your script uses plt.show(), the image is saved before the window opens. Ensure you close the plot window to finish the script execution.

📂 Project Files

  • bar_chart.py: Generates a Bar Chart.
  • histogram_chart.py: Generates a Histogram.
  • line_chart.py: Generates a Line Chart.
  • PIE_chart.py: Generates a Pie Chart.
  • scatter_chart.py: Generates a Scatter Chart.
  • Requirements.txt: List of dependencies.