Skip to content

msjabata25/-data-vis-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sales Dashboard with Matplotlib

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.

Features

  • 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

Visualizations Included

  1. Revenue vs Expenses - Line chart comparing monthly revenue and expenses
  2. Profit Analysis - Bar chart with color-coding based on profit levels and average line
  3. Customer Growth - Area chart showing customer acquisition trends
  4. Quarterly Distribution - Pie chart displaying revenue split across quarters

Project Structure

.
├── 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

Requirements

  • Python 3.7+
  • matplotlib
  • pandas
  • numpy

Installation

  1. Clone the repository:
git clone https://github.com/msjabata25/sales-dashboard.git
cd sales-dashboard
  1. Install required packages:
pip install matplotlib pandas numpy

Usage

Basic Usage

  1. Run the dashboard script:
python sales_dashboard.py
  1. When prompted, enter the CSV filename:
Enter CSV filename: sales_data.csv
  1. The dashboard will display with all 4 visualizations and print summary statistics

Using Your Own Data

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,365

Then run the script and enter your filename when prompted.

Sample Data Files

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

Usage/Examples

sales_data visualization

saas_company data visualization

retail_store data visualization

seasonal_business data visualization

Learning Concepts

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

Customization Examples

Change Chart Colors

axes[0, 0].plot(months, revenue, color='purple', linewidth=2)

Add Grid Only to Y-Axis

axes[0, 0].grid(True, alpha=0.3, axis='y')

Customize Bar Chart Colors

axes[0, 1].bar(months, profit, color='skyblue', edgecolor='navy')

Change Figure Size

fig, axes = plt.subplots(2, 2, figsize=(16, 12))

Code Structure

The main script follows this structure:

  1. Import libraries - matplotlib, pandas, numpy
  2. Load CSV data - read file and extract columns
  3. Calculate metrics - derive profit from revenue and expenses
  4. Create figure - set up subplot grid
  5. Plot 1: Line chart - revenue vs expenses trend
  6. Plot 2: Bar chart - profit analysis with conditional coloring
  7. Plot 3: Area chart - customer growth visualization
  8. Plot 4: Pie chart - quarterly revenue distribution
  9. Display results - show dashboard and print statistics

Error Handling

The script includes error handling for:

  • File not found errors
  • Missing columns in CSV
  • Invalid data formats
  • General exceptions

Tips for Beginners

  1. Start simple - modify one chart at a time
  2. Experiment with colors - try different color names
  3. Explore markers - use 'o', 's', 'D', '^' for different point styles
  4. Test with different data - try all 6 sample files
  5. Read documentation - check matplotlib.org for more options

Future Improvements

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

Resources

License

This project is open source and available under the MIT License.

Author

Created by yours truly and the ever helpful documentation and internet.

Contributing

Feel free to fork, modify, and submit pull requests with improvements!


Happy visualizing! 📊

About

My first attempt in building a finance dashboard using python's Matplotlib library and pandas.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages