Skip to main content

MatplotLibAPI

MatplotLibAPI is a Python library that simplifies the process of creating various types of plots from pandas DataFrames. It provides a high-level API for generating bubble charts, network graphs, pivot tables, tables, time series plots, treemaps, and sunburst charts.

Installation

To install the library, you can use pip:

pip install MatplotLibAPI

Generating Sample Data

The examples in this README use sample data that can be generated by running the generate_sample_data.py script:

python scripts/generate_sample_data.py

This will create a data directory with CSV files for each plot type.

Usage

Here's a simple example of how to create a bubble chart using MatplotLibAPI with a sample CSV file:

import pandas as pd
import matplotlib.pyplot as plt
from MatplotLibAPI import fplot_bubble

# Load the sample data
df = pd.read_csv('data/bubble.csv')

# Generate the bubble chart
fig = fplot_bubble(df, label='country', x='gdp_per_capita', y='population', z='population', title='Country Statistics')

# Display the plot
plt.show()

Plot Types

The library supports the following plot types:

  • Bubble (Scatter plot)
  • Bar / Stacked Bar
  • Histogram + KDE
  • Box / Violin
  • Heatmap / Correlation Matrix
  • Area
  • Pie / Donut
  • Waffle
  • Sankey
  • Network (Graph)
  • Pivot
  • Table
  • Timeserie
  • Treemap
  • Sunburst

Examples with Sample Data

This repository includes a data directory with sample CSV files for each plot type. Here's how you can use them:

Bubble Chart

import pandas as pd
from MatplotLibAPI import fplot_bubble

df = pd.read_csv('data/bubble.csv')
fig = fplot_bubble(df, label='country', x='gdp_per_capita', y='life_expectancy', z='population')
fig.show()

Network Graph

import pandas as pd
from MatplotLibAPI import fplot_network

df = pd.read_csv('data/network.csv')
fig = fplot_network(df)
fig.show()

Bar / Stacked Bar

import pandas as pd
from MatplotLibAPI import fplot_bar

df = pd.read_csv('data/bar.csv')
fig = fplot_bar(df, category='product', value='revenue', group='region', stacked=True)
fig.show()

Histogram + KDE

import pandas as pd
from MatplotLibAPI import fplot_histogram_kde

df = pd.read_csv('data/histogram.csv')
fig = fplot_histogram_kde(df, column='waiting_time_minutes', bins=8, kde=True)
fig.show()

Box / Violin

import pandas as pd
from MatplotLibAPI import fplot_box_violin

df = pd.read_csv('data/box_violin.csv')
fig = fplot_box_violin(df, column='satisfaction_score', category='department', use_violin=True)
fig.show()

Heatmap / Correlation Matrix

import pandas as pd
from MatplotLibAPI import fplot_heatmap, fplot_correlation_matrix

heatmap_df = pd.read_csv('data/heatmap.csv')
correlation_df = pd.read_csv('data/correlation.csv')

fig_heatmap = fplot_heatmap(heatmap_df, index='month', columns='channel', values='engagements')
fig_corr = fplot_correlation_matrix(correlation_df)

fig_heatmap.show()
fig_corr.show()

Area

import pandas as pd
from MatplotLibAPI import fplot_area

df = pd.read_csv('data/area.csv')
fig = fplot_area(df, x='quarter', y='subscriptions', label='segment', stacked=True)
fig.show()

Pie / Donut

import pandas as pd
from MatplotLibAPI import fplot_pie_donut

df = pd.read_csv('data/pie.csv')
fig = fplot_pie_donut(df, category='device', value='sessions', donut=True)
fig.show()

Waffle

import pandas as pd
from MatplotLibAPI import fplot_waffle

df = pd.read_csv('data/waffle.csv')
fig = fplot_waffle(df, category='device', value='sessions')
fig.show()

Sankey

import pandas as pd
from MatplotLibAPI import fplot_sankey

df = pd.read_csv('data/sankey.csv')
fig = fplot_sankey(df, source='source', target='target', value='value')
fig.show()

Pivot Table

import pandas as pd
from MatplotLibAPI.Pivot import plot_pivoted_bars

df = pd.read_csv('data/pivot.csv')
ax = plot_pivoted_bars(data=df, label="category", x="date", y="value")
ax.figure.show()

Table

import pandas as pd
from MatplotLibAPI import fplot_table

df = pd.read_csv('data/table.csv')
fig = fplot_table(pd_df=df, cols=["col1", "col2"])
fig.show()

Timeseries Plot

import pandas as pd
from MatplotLibAPI import fplot_timeserie

df = pd.read_csv('data/timeserie.csv')
fig = fplot_timeserie(pd_df=df, label="group", x="date", y="value")
fig.show()

Treemap

import pandas as pd
from MatplotLibAPI import fplot_treemap

df = pd.read_csv('data/treemap.csv')
fig = fplot_treemap(pd_df=df, path="path", values="values")
fig.show()

Sunburst Chart

import pandas as pd
from MatplotLibAPI import fplot_sunburst

df = pd.read_csv('data/sunburst.csv')
fig = fplot_sunburst(df, labels="labels", parents="parents", values="values")
fig.show()

Word Cloud

import pandas as pd
from MatplotLibAPI import fplot_wordcloud

df = pd.read_csv('data/wordcloud.csv')
fig = fplot_wordcloud(df, text_column="word", weight_column="weight")
fig.show()

Metadata

Release files for MatplotLibAPI 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MatplotLibAPI 3.3.0
File Size Uploaded Provenance Actions
matplotlibapi-3.3.0.tar.gz 44.6 kB Without provenance Details for matplotlibapi-3.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for MatplotLibAPI 3.3.0
File Interpreter ABI Platform Actions
matplotlibapi-3.3.0-py3-none-any.whl Python 3 none any Details for matplotlibapi-3.3.0-py3-none-any.whl

Total release size: 93.7 kB

Release files / matplotlibapi-3.3.0.tar.gz

Download URL matplotlibapi-3.3.0.tar.gz
Size 44.6 kB
Tags Source
SHA-256 checksum
How to use checksums
516fb21e125b74df34407b5dbab77135db0053103b5067cabaaaeed17d4c6b20
BLAKE2b-256 checksum
How to use checksums
bd93594acf96dd46dfc0ef00265255a4e01b432660dfec20aa131e13d49d7bf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / matplotlibapi-3.3.0-py3-none-any.whl

Download URL matplotlibapi-3.3.0-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c49886219d9cd7c8532509736e4f36d806f5f33ccf1fb3f0449b746b5c3298ae
BLAKE2b-256 checksum
How to use checksums
1370f1c9639c7b5cbb53e8dbdf358045950452371e0ddad3965a4704db4e1b16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for MatplotLibAPI 3.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page