Skip to main content

Matplotlib backend for direct plotting in the terminal.

Project description

kitcat

This project introduces a new kitcat backend for Matplotlib that allows plots to be displayed directly in the terminal. It utilizes the "agg" backend for rendering plots before sending them to the terminal.

  • Direct Matplotlib plotting in terminal emulators that support Kitty or iTerm2 graphics protocols.
  • Works seamlessly over SSH and inside tmux.

Installation

pip install kitcat

Usage

Select kitcat backend after importing matplotlib:

import matplotlib
matplotlib.use("kitcat")

or if pyplot is already imported, switch_backend() can be used to select kitcat backend:

import matplotlib.pyplot as plt
plt.switch_backend("module://kitcat")

Terminal Emulator Support

Kitty and Ghostty are the recommended terminals. They implement modern protocol which let kitcat embed the image into the terminal's text buffer rather than overlaying it on the screen. This means plots scroll with the buffer, clip correctly at pane boundaries, and behave properly inside tmux — see tmux notes. Other supported terminals still work, but the image is drawn at a fixed screen position and won't track the buffer as cleanly.

Terminal Emulator Supported Notes
Kitty ✅✨
Ghostty ✅✨
iTerm2
VSCode Requires terminal.integrated.enableImages in settings
WezTerm
tmux See tmux notes
Warp
wayst
st Requires st-kitty-graphics patch
Zellij
Alacritty
Terminal.app (macOS)

tmux notes

On Kitty and Ghostty, kitcat uses Unicode placeholders so the image becomes part of tmux's text buffer — it scrolls with the buffer, clips at the pane boundary, and disappears when the pane is hidden. On other terminals, the image is drawn directly by the outer emulator and stays at a fixed screen position (so it can persist when switching panes — this is a tmux/terminal limitation, not a kitcat one).

Either way, set -g allow-passthrough on is required in your tmux config.

Acknowledgements

I discovered matplotlib-backend-kitty repository, which provides similar functionality in Kitty. I aimed to create a simpler solution that works across any terminal supporting the protocol.

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

kitcat-2.0.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

kitcat-2.0.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file kitcat-2.0.1.tar.gz.

File metadata

  • Download URL: kitcat-2.0.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.11

File hashes

Hashes for kitcat-2.0.1.tar.gz
Algorithm Hash digest
SHA256 03e94e0ae01b70617e9e925d37abb6656948360804ad9fefb2ae08a6638509b2
MD5 eaae88276e7c853de76238ffb6c969bc
BLAKE2b-256 477e990291c8b79242a720b73b61eb54bc4308f98115590a84edfd8595a6553c

See more details on using hashes here.

File details

Details for the file kitcat-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: kitcat-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.11

File hashes

Hashes for kitcat-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b9060188aa4d36987c24f80c24a4814480771bd95d9cd3154b7e0ce651049cb
MD5 49e3671ee79b574361a0fc7ecd8849db
BLAKE2b-256 ff94790e38db087d5988f7a45677291f64b96f09c677464bf13628f98ca38467

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