Skip to content
igaurab edited this page Nov 18, 2026 · 2 revisions

gpython shows Matplotlib figures and other image/png outputs as pictures in the terminal.

How gpython draws a picture

gpython uses the first method that the terminal has.

Method Terminals Result
Kitty graphics protocol Kitty, Ghostty, Rex, WezTerm, Konsole A full picture
Sixel Terminals with Sixel A full picture
Colored half cells Other terminals A coarse picture
No graphics — The size of the image, with View and Download buttons
  • A picture has the width of the cell and a maximum height of 30 rows.
  • View opens the image in the browser. Download saves it as PNG.
  • In tmux, gpython does not use the kitty protocol.
  • GPYTHON_KITTY_IMAGES=0 turns the kitty protocol off. gpython then uses the next method.

Image viewer

Press v in cell mode to see the image of the cell on the full screen. :img does the same. The bottom bar shows this option when the selected cell has an image.

Key Action
+ / - Zoom in / out
0 Fit to the screen
1 Actual size
h j k l Move the image
n / p Next / previous image
s Save as PNG
o Open in the browser
q Close

Commands

Command Action
:img Show the first image of this cell
:img 2 Show the second image of this cell
:img save [file] Save the images of this cell as PNG
:img save 2 plot.png Save the second image as plot.png
:img open Open the images of this cell in the browser
:img open 2 Open the second image in the browser
:img save all Save each image in the notebook
:img open all Open each image in the notebook

Give the image number before the file name.

Where the files go

Action Location
Save The folder of the notebook. For a notebook without a name: the current folder
Open in the browser A gpython folder in the temporary folder of the system

File names come from the notebook name and the cell number: nb-c3.png. When a cell has more than one image, the name gets a number: nb-c5-1.png. When gpython makes the name, it does not overwrite a file that exists. It uses a new name. When you give the file name, gpython writes to that file.

Pictures in markdown cells

Markdown cells can show pictures and animated GIFs. See Markdown cells.

Clone this wiki locally