Skip to content

PlotSenseAI/PlotSense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

210 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 PlotSense: AI-Powered Data Visualization Assistant

PyPI version Downloads Python Tests Frontend Tests codecov Python Version License Code style: flake8

πŸ“Œ Overview

PlotSense is an AI-powered assistant that helps data professionals and analysts make smarter, faster, and more explainable data visualizations. Whether you're exploring a new dataset or building dashboards, PlotSense simplifies the process with:

  • βœ… Smart Visualization Suggestions - Recommends the best plots based on your data structure and relationships.
  • πŸ“Š Visualization Plot - Generates suggested plot with ease.
  • 🧠 Natural Language Explanations – Automatically explains charts in plain English.
  • πŸ”— Seamless Integration – Works out of the box with pandas, matplotlib, and seaborn.

Let AI supercharge your EDA (Exploratory Data Analysis).

πŸ“š Documentation

πŸ’¬ Community

Join our community to get help, share ideas, and connect with other PlotSense users:

  • πŸ’­ Discord Server - Chat with the community and get real-time support

⚑ Quickstart

πŸ”§ Install the package

Using pip:

pip install plotsense

Using uv (recommended for faster installation):

uv pip install plotsense

🧠 Import PlotSense:

import plotsense as ps
from plotsense import recommender, plotgen, explainer

πŸ” Authenticate with Groq API:

Get your free API key from Groq Cloud https://console.groq.com/home

import os
# Set GROQ_API_KEY environment variable
os.environ['GROQ_API_KEY'] = 'your-api-key-here'

#or

# Set API key (one-time setup)
ps.set_api_key("your-api-key-here")

πŸš€ Core Features

🎯 1. AI-Recommended Visualizations

Let PlotSense analyze your data and suggest optimal charts.

import pandas as pd
# Load your dataset (e.g., pandas DataFrame)
df = pd.read_csv("data.csv")

# Get AI-recommended visualizations
suggestions = recommender(df) # default number of suggestions is 5
print(suggestions)

πŸ“Š Sample Output:

alt text

πŸŽ›οΈ Want more suggestions?

suggestions = recommender(df, n=10)  

πŸ“ˆ 2. One-Click Plot Generation

Generate recommended charts instantly using .iloc

plot1 = plotgen(df, suggestions.iloc[0]) # This will plot a bar chart with variables 'survived', 'pclass'
plot2 = plotgen(df, suggestions.iloc[1]) # This will plot a bar chart with variables 'survived', 'sex'
plot3 = plotgen(df, suggestions.iloc[2]) # This will plot a histogram with variable 'age'

or Generate recommended charts instantly using three argurments

plot1 = plotgen(df, 0, suggestions) # This will plot a bar chart with variables 'survived', 'pclass'
plot2 = plotgen(df, 1, suggestions) # This will plot a bar chart with variables 'survived', 'sex'
plot3 = plotgen(df, 2, suggestions) # This will plot a histogram with variable 'age'

πŸŽ›οΈ Want more control?

plot1 = plotgen(df, suggestions.iloc[0], x='pclass', y='survived')

Supported Plots

  • scatter
  • bar
  • barh
  • histogram
  • boxplot
  • violinplot
  • pie
  • hexbin

🧾 3. AI-Powered Plot Explanation

Turn your visualizations into stories with natural language insights:

explanation = explainer(plot1)

print(explanation)

βš™οΈ Advanced Options

  • Custom Prompts: You can provide your own prompt to guide the explanation
explanation = explainer(
    fig,
    prompt="Explain the key trends in this sales data visualization"
)
  • Multiple Refinement Iterations: Increase the number of refinement cycles for more polished explanations:
explanation = explainer(fig, max_iterations=3)  # Default is 2

πŸ”„ Combined Workflow: Suggest β†’ Plot β†’ Explain

suggestions = recommender(df)
plot = plotgen(df, suggestions.iloc[0])
insight = explainer(plot)

πŸ§ͺ Testing

PlotSenseAI has comprehensive test coverage for both Python and frontend code.

Quick Test Commands

Python Tests:

# Run all tests
pytest

# Run with coverage
pytest --cov=plotsense --cov-report=html

# Run fast tests only (skip slow tests)
pytest -m "not slow"

Frontend Tests:

cd web

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run in watch mode
npm test -- --watch

Test Infrastructure

  • Backend: pytest with 950+ lines of tests covering:

    • Unit tests for individual functions
    • Integration tests for component interaction
    • End-to-end workflow tests
    • Mock external API calls (Groq)
  • Frontend: Vitest + React Testing Library

    • Component tests for UI elements
    • User interaction testing
    • Accessibility testing
  • CI/CD: GitHub Actions runs tests automatically on every push and PR

  • Pre-commit Hooks: Automated linting and quick tests before commits

For detailed testing documentation, see TESTING.md.

Setting Up Development Environment

Using uv (recommended):

# Install uv if not already installed
# Visit https://docs.astral.sh/uv/getting-started/installation/

# Sync all dependencies including dev extras
uv sync --all-extras

# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On Unix or macOS:
source .venv/bin/activate

# Install frontend dependencies
cd web && npm install

# Install pre-commit hooks (optional but recommended)
uv run pre-commit install

Using pip (traditional):

# Install Python dependencies
pip install -e .
pip install pytest pytest-cov pytest-mock

# Install frontend dependencies
cd web && npm install

# Install pre-commit hooks (optional but recommended)
pip install pre-commit
pre-commit install

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start for Contributors

  1. Fork and clone the repository

  2. Set up development environment:

    Using uv (recommended):

    # Install uv: https://docs.astral.sh/uv/getting-started/installation/
    uv sync --all-extras
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    uv run pre-commit install

    Using pip:

    pip install -e .
    pip install pytest pytest-cov pytest-mock pre-commit
    pre-commit install
  3. Create a feature branch: git checkout -b feature/your-feature

  4. Make changes and add tests

  5. Run tests: uv run pytest (or pytest) and cd web && npm test

  6. Submit a Pull Request

Branching Strategy

  • main β†’ Production-ready version
  • dev β†’ Active development
  • feature/<feature-name> β†’ New features
  • fix/<bug-name> β†’ Bug fixes

πŸ’‘ How to Help

πŸ“… Roadmap

Upcoming features:

  • More model integrations
  • Automated insight highlighting
  • Jupyter widget support
  • Features/target analysis
  • More supported plots
  • PlotSense web interface
  • PlotSense customised notebook template

πŸ“₯ Install or Update

Using pip:

pip install --upgrade plotsense  # Get the latest features!

Using uv:

uv pip install --upgrade plotsense  # Get the latest features faster!

πŸ‘₯ Maintainers

PlotSense is maintained by a dedicated team of developers and data scientists:

Name GitHub Email
Christian Chimezie @christianchimezie chimeziechristiancc@gmail.com
Toluwaleke Ogidan @T-leke gbemilekeogidan@gmail.com
Onyekachukwu Ojumah @ojumah20 Onyekaojumah22@gmail.com
Grace Farayola @Itsmeright gracefarayola@gmail.com
Amaka Iduwe @Nwaamaka-Iduwe nwaamaka_iduwe@yahoo.com
Nelson Ogbeide @Nelsonchris1 Ogbeide331@gmail.com
Abayomi Olagunju @jerryola1 https://abayomiolagunju.net/
Olamilekan Ajao @olamilekanajao olamilekan011@gmail.com

We welcome contributions from the community! See CONTRIBUTING.md for guidelines.

πŸ›‘ License

Apache License 2.0

πŸ” API & Privacy Notes

  • Your API key is securely held in memory for your current Python session.
  • All requests are processed via Groq's API serversβ€”no data is stored locally by PlotSense.
  • Requires an internet connection for model-backed features.

Let your data speakβ€”with clarity, power, and PlotSense. πŸ“Šβœ¨

Your Feedback

Feedback Form

About

PlotSense is an AI-powered assistant that helps data professionals and analysts make smarter, faster, and more explainable data visualizations. Whether you're exploring a new dataset or building dashboards, PlotSense simplifies the process with Smart Visualization Suggestions, Natural Language Explanations and Seamless Integration

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors