Skip to main content

Memes with Python's matplotlib

Project description

CI codecov Docs PyPI version conda-forge version Python versions License: MIT

memeplotlib logotype

Memes with Python's matplotlib. Create image macro memes using matplotlib for rendering and the memegen API for template discovery.

Installation

pip install memeplotlib
# or
conda install -c conda-forge memeplotlib

For the Model Context Protocol server (use memes from Claude Desktop / Claude Code / any MCP client):

pip install "memeplotlib[mcp]"

Quick start

import memeplotlib as memes

fig, ax = memes.meme("buzz", "memes", "memes everywhere")
fig.savefig("buzz.png")

buzz meme example

The function returns (Figure, Axes) — same convention as seaborn, pandas.plot, and other matplotlib extensions. It does not call plt.show() implicitly. Pass show=True if you want auto-display.

Features

Memegen IDs, file paths, or URLs as templates:

memes.meme("drake", "writing tests", "shipping to prod", color="yellow")
memes.meme("/path/to/image.jpg", "top text", "bottom text")
memes.meme("https://example.com/image.png", "from a URL")

drake functional example

Object-oriented Meme builder, chainable:

from memeplotlib import Meme

Meme("buzz").top("python").bottom("python everywhere").save("buzz.png")

buzz OO chained example

Memify existing matplotlib figures:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
memes.memify(fig, "stonks")

memify stonks example

RcParams-style scoped configuration:

with memes.rc_context({"font": "comic", "color": "yellow"}):
    memes.meme("buzz", "scoped style", "no leakage")
# defaults are auto-restored here

# Or set globally:
memes.config["fontsize"] = 96

global configuration example

Forward **kwargs to Axes.text:

memes.meme("buzz", "rotated", rotation=15, alpha=0.8)

Use from agents

pip install "memeplotlib[mcp]"
memeplotlib-mcp                                 # boot the MCP server (stdio)
memeplotlib meme buzz "hello" "world" -o /tmp/  # CLI render

The MCP server exposes meme, search_templates, and list_templates tools. The CLI is useful even without MCP — agent harnesses can shell out, and CI scripts can render directly.

Documentation

Full docs including a tutorial, user guide, conventions reference, and API reference: brianckeegan.github.io/memeplotlib.

Build locally:

pip install -e ".[docs]"
sphinx-build -W docs docs/_build

How it works

  1. Templates are fetched from the memegen API (blank background images + metadata) and cached locally.
  2. Text is rendered with matplotlib's text system using patheffects.Stroke for the classic outlined meme look.
  3. The bundled Anton font (Impact-like, SIL OFL licensed) is used as a fallback for systems where Impact isn't installed.

Related projects

  • matplotlib — the rendering engine.
  • memegen — the template registry and blank-image source (api.memegen.link).
  • seaborn — the API conventions for ax=None, **kwargs forwarding, and (fig, ax) returns are modeled on seaborn.

Dependencies

  • matplotlib >= 3.8
  • numpy, requests, Pillow, platformdirs

Requires Python 3.10+.

License

MIT. The bundled Anton font is licensed under the SIL Open Font License v1.1.

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

memeplotlib-0.2.0.tar.gz (22.7 MB view details)

Uploaded Source

Built Distribution

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

memeplotlib-0.2.0-py3-none-any.whl (109.5 kB view details)

Uploaded Python 3

File details

Details for the file memeplotlib-0.2.0.tar.gz.

File metadata

  • Download URL: memeplotlib-0.2.0.tar.gz
  • Upload date:
  • Size: 22.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memeplotlib-0.2.0.tar.gz
Algorithm Hash digest
SHA256 187007f0c15b95d7bdd593afc9adbfa8780c4aaec245b083f36adca8529bccc0
MD5 eca48521c422c62f0c769ddf1da91f23
BLAKE2b-256 7fb02b32735355a22b7ed0249885e48136b33467fe4bb2d4f6f952320f91901e

See more details on using hashes here.

Provenance

The following attestation bundles were made for memeplotlib-0.2.0.tar.gz:

Publisher: publish_pypi.yml on brianckeegan/memeplotlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memeplotlib-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: memeplotlib-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 109.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memeplotlib-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aadbf1ed98b748f1c18a32499b42ed5aa2668a0bdf5646f2f275116383f5dea6
MD5 4c8a4c464f996dea0f70236967c4de6f
BLAKE2b-256 07dcc70ef67c19f80b863732a68b94afb563c9622767bd503638c06ef80c84bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for memeplotlib-0.2.0-py3-none-any.whl:

Publisher: publish_pypi.yml on brianckeegan/memeplotlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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