A beginner-friendly Python project for learning data visualization using Matplotlib. This project creates an interactive dashboard that visualizes sales data including revenue, expenses, profit, and customer metrics.
- Multi-chart dashboard with 4 different visualization types
- Line charts for tracking revenue vs expenses and customer growth
- Bar charts for monthly profit analysis
- Pie charts for quarterly revenue distribution
- CSV file support - load your own data files
- Customizable visualizations - easy to modify colors, styles, and layouts
- Revenue vs Expenses - Line chart comparing monthly revenue and expenses
- Profit Analysis - Bar chart with color-coding based on profit levels and average line
- Customer Growth - Area chart showing customer acquisition trends
- Quarterly Distribution - Pie chart displaying revenue split across quarters
.
├── README.md
├── sales_dashboard.py # Main dashboard script
├── sales_data.csv # Sample data file
├── quarterly_sales.csv # Alternative sample data
├── tech_startup_metrics.csv # Growth-focused sample data
├── retail_store.csv # High-volume retail sample data
├── saas_company.csv # Steady growth sample data
└── seasonal_business.csv # Seasonal pattern sample data
- Python 3.7+
- matplotlib
- pandas
- numpy
- Clone the repository:
git clone https://github.com/msjabata25/sales-dashboard.git
cd sales-dashboard- Install required packages:
pip install matplotlib pandas numpy- Run the dashboard script:
python sales_dashboard.py- When prompted, enter the CSV filename:
Enter CSV filename: sales_data.csv
- The dashboard will display with all 4 visualizations and print summary statistics
Create a CSV file with the following columns:
Month- Month name (e.g., "January", "February")Revenue- Monthly revenue (numeric)Expenses- Monthly expenses (numeric)Customers- Number of customers (numeric)
Example:
Month,Revenue,Expenses,Customers
January,45000,28000,340
February,52000,31000,390
March,48000,29500,365Then run the script and enter your filename when prompted.
Six sample datasets are included for testing:
| File | Description | Use Case |
|---|---|---|
sales_data.csv |
Steady growth pattern | General testing |
quarterly_sales.csv |
Consistent quarterly increases | Quarterly analysis |
tech_startup_metrics.csv |
Exponential growth | Growth trajectory |
retail_store.csv |
High customer volume | Large-scale retail |
saas_company.csv |
Predictable steady growth | Subscription models |
seasonal_business.csv |
Holiday season peaks | Seasonal businesses |
This project teaches:
- Matplotlib basics - plotting, customization, layouts
- Subplots - creating multi-chart dashboards
- Data handling - reading CSV files with pandas
- Chart types - line, bar, and pie charts
- Styling - colors, markers, legends, grids
- List comprehensions - calculating derived data (profit)
- Error handling - file validation and exception handling
axes[0, 0].plot(months, revenue, color='purple', linewidth=2)axes[0, 0].grid(True, alpha=0.3, axis='y')axes[0, 1].bar(months, profit, color='skyblue', edgecolor='navy')fig, axes = plt.subplots(2, 2, figsize=(16, 12))The main script follows this structure:
- Import libraries - matplotlib, pandas, numpy
- Load CSV data - read file and extract columns
- Calculate metrics - derive profit from revenue and expenses
- Create figure - set up subplot grid
- Plot 1: Line chart - revenue vs expenses trend
- Plot 2: Bar chart - profit analysis with conditional coloring
- Plot 3: Area chart - customer growth visualization
- Plot 4: Pie chart - quarterly revenue distribution
- Display results - show dashboard and print statistics
The script includes error handling for:
- File not found errors
- Missing columns in CSV
- Invalid data formats
- General exceptions
- Start simple - modify one chart at a time
- Experiment with colors - try different color names
- Explore markers - use 'o', 's', 'D', '^' for different point styles
- Test with different data - try all 6 sample files
- Read documentation - check matplotlib.org for more options
Ideas to extend this project:
- Add more chart types (histograms, scatter plots, box plots)
- Interactive charts with hover tooltips
- Save visualizations as PNG/PDF
- Data filtering by date range
- Multiple datasets comparison
- Real-time data updates
- Web interface with Flask/Streamlit
This project is open source and available under the MIT License.
Created by yours truly and the ever helpful documentation and internet.
Feel free to fork, modify, and submit pull requests with improvements!
Happy visualizing! 📊



