Skip to content

yapplotlib

A matplotlib plugin for rendering chat transcripts as publication-quality figures.

Instead of scrolling through this...

[
  { "role": "user",      "content": "Have you heard of yapplotlib?" },
  { "role": "assistant", "content": "Yes! It's a matplotlib plugin for rendering chat logs as figures." },
  { "role": "user",      "content": "That's quite meta." },
  { "role": "assistant", "content": "Indeed." }
]

...see it how your brain is used to.

Chat thread rendered in the default style

Designed for embedding LLM conversations in academic papers, slides, and notebooks as native matplotlib subplots — alongside your other figures.

Installation

uv add yapplotlib
# or
pip install yapplotlib

Quick start

import yapplotlib

messages = [
    {'role': 'system',    'content': 'You are a helpful assistant.'},
    {'role': 'user',      'content': 'What is the capital of France?'},
    {'role': 'assistant', 'content': 'The capital of France is Paris.'},
]

fig, ax = yapplotlib.chatplot(messages, style='paper')
fig.savefig('chat.pdf', bbox_inches='tight')

Themes

Four themes: default, paper, dark, minimal

Theme Description
'default' WhatsApp-style green/white, sans-serif
'paper' Greyscale, serif — survives black-and-white printing
'dark' Dark background for slides and web
'minimal' Outline only, no fill

See the Usage guide for embedding, options, and customisation.