This project contains Python scripts to generate various types of charts (Bar, Histogram, Line, Pie, Scatter) using matplotlib.
- Python 3.x
- PIP (Python Package Installer)
- Open the project folder in your terminal or VS Code.
- Activate the Virtual Environment:
- Windows (PowerShell):
.\.venv\Scripts\activate
- Mac/Linux:
source .venv/bin/activate
- Windows (PowerShell):
- Install Requirements (if not already installed):
pip install -r Requirements.txt
Always run the scripts using the Python interpreter from your virtual environment:
.\.venv\Scripts\python.exe <script_name>.pyExample:
.\.venv\Scripts\python.exe histogram_chart.pyIf you click the Run button and images are not saving, VS Code is likely using the wrong Python interpreter.
To fix this:
- Press
Ctrl + Shift + Pwithin VS Code. - Type and select
Python: Select Interpreter. - Choose the option that says
('.venv': venv)or looks like.\.venv\Scripts\python.exe. - Now, the "Run" button will work correctly!
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
matplotlibinstalled. - Fix: Follow the instructions above to use the
.venvenvironment. - 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.
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.