Skip to content

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

PlotMind 📊

Convert any CSV into meaningful graphs automatically.

PlotMind analyses your CSV, detects column types, recommends the best chart, and generates it — with zero manual configuration. It supports interactive charts via Plotly and static charts via Matplotlib, and can export to PNG, PDF, or HTML.


Installation

pip install plotmind

Or install from source:

git clone https://github.com/git-rohan7/plotmind
cd plotmind
pip install -e .

Quick Start

Python API

fromplotmindimportload_csv, clean_dataframe, plot, export# 1. Loaddf=load_csv("sales.csv")
# 2. Clean (handles missing values, duplicates, type coercion)df=clean_dataframe(df, verbose=True)
# 3. Plot – auto-detects best chartfig=plot(df)
# 4. Exportexport(fig, "sales_chart.html")
export(fig, "sales_chart.png")

Command-Line Interface

# Auto-detect best chart and display
plotmind sales.csv
# Choose a specific chart type
plotmind sales.csv --chart bar
# Specify axes
plotmind sales.csv --chart scatter --x revenue --y profit
# Export to file without displaying
plotmind sales.csv --chart line --export output.html
# Use matplotlib backend
plotmind sales.csv --backend matplotlib --export chart.png
# Show column info and recommendation
plotmind sales.csv --info

Features

FeatureDescription
Auto-chart selectionDetects the best chart based on column types
Column type detectionIdentifies numerical, categorical, datetime, boolean columns
Data cleaningFills missing values, removes duplicates, fixes types
Interactive chartsPlotly backend for zoom/hover/pan
Static chartsMatplotlib backend for PNG/PDF output
ExportPNG, PDF, HTML, SVG
CLIFull command-line interface

Chart Types

PlotMind supports these chart types (auto-selected or manually chosen):

ChartWhen auto-selected
histogramSingle numerical column
barCategorical + numerical (high cardinality)
pieCategorical + numerical (≤6 unique categories)
scatterTwo numerical columns
lineDatetime + numerical
heatmapMany numerical columns (correlation matrix)
boxBox plot for distribution

API Reference

load_csv(filepath, **kwargs) → DataFrame

Load a CSV and validate it.

df=load_csv("data.csv")

clean_dataframe(df, verbose=False) → DataFrame

Clean: fill missing values, remove duplicates, coerce types.

df=clean_dataframe(df, verbose=True)

detect_columns(df) → dict

Return a dict of {column_name: type} for each column. Types: numerical, categorical, datetime, boolean, unknown.

fromplotmindimportdetect_columnstypes=detect_columns(df)
# {'age': 'numerical', 'city': 'categorical', ...}

recommend_chart(df, x=None, y=None) → (chart, x_col, y_col)

Recommend the best chart. Returns a tuple.

fromplotmindimportrecommend_chartchart, x, y=recommend_chart(df)
print(chart) # e.g. 'scatter'

plot(df, chart=None, x=None, y=None, title=None, backend='plotly', show=True) → Figure

Generate a chart. Returns the figure object.

fig=plot(df, chart="bar", x="city", y="sales", title="Sales by City")
fig=plot(df, backend="matplotlib", show=False) # static, no display

export(fig, path, fmt=None) → str

Export the figure. Format is inferred from the file extension.

export(fig, "chart.png") # PNG (requires kaleido for Plotly)export(fig, "chart.pdf") # PDFexport(fig, "chart.html") # Interactive HTML (Plotly) or embedded HTML (Matplotlib)export(fig, "chart.svg") # SVG

Utils

fromplotmind.utilsimportpreview, column_stats, filter_columnspreview(df) # Print headcolumn_stats(df) # Summary DataFrame with null counts, unique values, etc.filter_columns(df, types=["number"]) # Get only numeric column names

Testing

pip install plotmind[dev]
pytest tests/ -v

Requirements

  • Python ≥ 3.8
  • pandas ≥ 1.3
  • plotly ≥ 5.0
  • matplotlib ≥ 3.4
  • kaleido ≥ 0.2.1 (for Plotly static image export)

Optional:

  • seaborn (for nicer heatmaps with pip install plotmind[seaborn])

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages