Skip to main content

A Python plotting package with a dual Seaborn/Matplotlib + Plotly backend.

Project description

Plotify

Plotify is a Python plotting package built around two ideas:

  1. Auto-pick — given a dataframe and column names, Plotify infers the right chart from the data shape and types. No need to remember which function to call.
  2. Publication-ready by default — every chart ships with a colourblind-safe palette, smart tick formatting (1.2K, 3.4M), minimalist spines, and consistent typography on both backends.

Every plot can render on either Seaborn/Matplotlib (static images) or Plotly (interactive HTML).

The chart catalogue and category split (Numerical, Categoric, Num & Cat, Time series, Network, Maps) are inspired by data-to-viz.com.

Demo notebooks

The fastest way to see what Plotify can do — runnable notebooks under notebooks/ with every chart class rendered on both backends:

Outputs are committed, so the notebooks render fully on GitHub without running them.

Two-line example

import pandas as pd, plotify

df = pd.DataFrame({
    "date": pd.date_range("2024-01-01", periods=12, freq="MS"),
    "sales": [120, 140, 90, 200, 220, 260, 240, 310, 280, 330, 360, 410],
    "region": ["North"] * 6 + ["South"] * 6,
})

plotify.auto(df, x="date", y="sales", color="region", backend="plotly")\
       .save_plot("sales.html")

plotify.auto looks at the dtypes (datetime, numeric, low-cardinality group), picks LineChart, and returns a beautifully themed figure.

What auto actually picks

plotify.suggest(df, x="date", y="sales", color="region")
# → [Suggestion(LineChart,        score=0.96, reason="datetime x + numeric y + low-cardinality group → multi-series line chart"),
#    Suggestion(StackedAreaChart, score=0.72, reason="stacked area variant for compositional time series")]

Suggestions come ranked, each with a one-line reason — useful for debugging or for showing the user why a chart was picked.

You can also pass an intent to override the rules:

plotify.auto(df, x="region", y="sales", intent="distribution")
# → Violinplot

Themes

plotify.theme controls the look of every chart on both backends.

import plotify

plotify.theme.get_current().name      # "publication" — applied automatically
plotify.theme.set("none")             # opt out, use library defaults
plotify.theme.register(plotify.theme.Theme(name="brand", palette=("#FF1493", "#00CED1")))
plotify.theme.set("brand")

Package structure

plotify/
├── base.py              # BasePlot — backend dispatch + save
├── numerical/           # Boxplot, DensityPlot, Violinplot, ScatterPlot, ConnectedScatterPlot
├── categorical/         # BarPlot, PieChart, Treemap, Sunburst, Venn, Dendrogram, etc. (12)
├── num_cat/             # GroupedBarPlot, StackedBarPlot, GroupedScatter, BoxPlotByGroup
├── timeseries/          # LineChart, AreaChart, StackedAreaChart, StreamGraph
├── network/             # NetworkDiagram, ChordDiagram, SankeyDiagram, ArcDiagram, HierarchicalEdgeBundling
└── maps/                # ChoroplethMap, BubbleMap, HexbinMap, Cartogram, ConnectionMap

Installation

pip install plotify-charts          # PyPI distribution name
pip install plotify-charts[maps]    # adds geopandas for ChoroplethMap's seaborn path
pip install plotify-charts[full]    # all optional extras

The Python import name is plotify regardless of which install variant you pick:

import plotify

If you've cloned the repo for development, install with Poetry instead:

poetry install --with dev --extras full

Usage

import pandas as pd
from plotify.numerical import Boxplot
from plotify.categorical import BarPlot, PieChart
from plotify.timeseries import LineChart
from plotify.network import SankeyDiagram

df = pd.DataFrame({"cat": list("AAABBB"), "val": [1, 2, 3, 4, 5, 6]})

# Seaborn/Matplotlib backend → static image.
Boxplot(df, x="cat", y="val", backend="seaborn").save_plot("box.png")

# Plotly backend → interactive HTML (or static image via kaleido).
BarPlot(df, x="cat", y="val", backend="plotly").save_plot("bar.html")
PieChart(df, names="cat", values="val", backend="plotly").save_plot("pie.html")

# Sankey flow with explicit source/target/value lists.
SankeyDiagram(
    source=[0, 1, 0],
    target=[2, 2, 3],
    value=[8, 4, 2],
    labels=["A", "B", "C", "D"],
    backend="plotly",
).save_plot("sankey.html")

Every plot class accepts backend="seaborn" (default) or backend="plotly". A few classes only support one backend — WordCloudPlot, VennDiagram, CircularPacking, StreamGraph, ChordDiagram, ArcDiagram, HierarchicalEdgeBundling, and Cartogram are Seaborn-only because Plotly has no native equivalent. Requesting an unsupported backend raises a ValueError at construction time.

Chart catalogue (all implemented)

Category Classes
Numerical Boxplot, DensityPlot, Violinplot, ScatterPlot, ConnectedScatterPlot
Categoric BarPlot, LollipopChart, RadarChart, ParallelCoordinates, WordCloudPlot, PieChart, DoughnutChart, Treemap, CircularPacking, SunburstDiagram, VennDiagram, Dendrogram
Num & Cat GroupedBarPlot, StackedBarPlot, GroupedScatter, BoxPlotByGroup
Time series LineChart, AreaChart, StackedAreaChart, StreamGraph
Network NetworkDiagram, ChordDiagram, SankeyDiagram, ArcDiagram, HierarchicalEdgeBundling
Maps ChoroplethMap, BubbleMap, HexbinMap, Cartogram, ConnectionMap

Development

Run the test suite:

poetry run pytest

The notebooks under notebooks/ are generated from scripts/build_notebooks.py — please don't hand-edit them. After changing an API or a chart class, rebuild and re-execute in a single step:

python scripts/build_notebooks.py --execute

The --execute flag runs each notebook via jupyter nbconvert so the rendered outputs are embedded in the committed .ipynb files. The script sets PYTHONPATH to the repo root automatically, so it works without pip-installing the package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotify_charts-0.1.0.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plotify_charts-0.1.0-py3-none-any.whl (71.9 kB view details)

Uploaded Python 3

File details

Details for the file plotify_charts-0.1.0.tar.gz.

File metadata

  • Download URL: plotify_charts-0.1.0.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.7 Windows/11

File hashes

Hashes for plotify_charts-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff8d082c5eb5465dc0da418b61ade8f7f2aa4cf7314b9d8b640f3dc88e979549
MD5 0f5b7340c859b16c5551959133fd2295
BLAKE2b-256 7e983284b61b69d827657c1ab3fa34e0399963f18ad7b160be499084bf2bde40

See more details on using hashes here.

File details

Details for the file plotify_charts-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: plotify_charts-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 71.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.7 Windows/11

File hashes

Hashes for plotify_charts-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a78d4e8c9d31f720ff90331fd37ec3814b0b9483cceeb065bbf79f6aa3a0798d
MD5 44c595bdcee13e06cba70dc992460e2c
BLAKE2b-256 8f81bb0df5abb9f02c50aa18a99ee7785f5e24636de3f9d25ca7d820c2cd0afc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page