# Images

tomes shows images with the best protocol your terminal has:

| Protocol | Terminals |
|----|----|
| Kitty graphics | Kitty, Ghostty, Konsole |
| iTerm2 inline images | iTerm2, WezTerm |
| Sixel | foot, Windows Terminal, xterm, mlterm |
| Half blocks (`▀`, two pixels per character) | Every other terminal, like Alacritty and Terminal.app |

tomes asks the terminal which one it supports when it starts. `:images` shows what it found, and `--images kitty` (or `iterm2`, `sixel`, `halfblocks`, `none`) chooses one yourself.

`Enter` on a figure shows it full screen; there, `o` opens it in your image viewer. `Space i` turns images off and on.


# Inside tmux

tmux passes images to your terminal only with passthrough on:

``` bash
# ~/.tmux.conf
set -g allow-passthrough on
```

Without it, tomes doesn't ask the terminal (no one would answer) and uses half blocks.


# What half blocks look like

The screenshots on this website are made in a terminal without images, so they show half blocks:


tomes


``` term-output
tomes https://r4ds.hadley.nz/ -c 'Data visualization'
```


tomes


``` term-screen
 R for Data Science (2e)         │                                                                           ┃
 Welcome                         │ 1  Data visualization                                                     │
 Preface to the second edition   │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  │
 Introduction                    │                                                                           │
 Whole game                      │ 1.1 Introduction                                                          │
▸1  Data visualization           │ ────────────────                                                          │
   1.1 Introduction              │                                                                           │
     1.1.1 Prerequisites         │ │ "The simple graph has brought more information to the data analyst's    │
   1.2 First steps               │ │ mind than any other device." -- John Tukey                               │
     1.2.1 The penguins data f…  │                                                                           │
     1.2.2 Ultimate goal         │ R has several systems for making graphs, but ggplot2 is one of the most   │
     1.2.3 Creating a ggplot     │ elegant and most versatile. ggplot2 implements the grammar of graphics,   │
     1.2.4 Adding aesthetics a…  │ a coherent system for describing and building graphs. With ggplot2, you   │
     1.2.5 Exercises             │ can do more and faster by learning one system and applying it in many     │
   1.3 ggplot2 calls             │ places.                                                                   │
   1.4 Visualizing distributio…  │                                                                           │
     1.4.1 A categorical varia…  │ This chapter will teach you how to visualize your data using ggplot2. We  │
     1.4.2 A numerical variable  │ will start by creating a simple scatterplot and use that to introduce     │
     1.4.3 Exercises             │ aesthetic mappings and geometric objects - the fundamental building       │
   1.5 Visualizing relationshi…  │ blocks of ggplot2. We will then walk you through visualizing              │
     1.5.1 A numerical and a c…  │ distributions of single variables as well as visualizing relationships    │
     1.5.2 Two categorical var…  │ between two or more variables. We'll finish off with saving your plots    │
     1.5.3 Two numerical varia…  │ and troubleshooting tips.                                                 │
     1.5.4 Three or more varia…  │                                                                           │
     1.5.5 Exercises             │ 1.1.1 Prerequisites                                                       │
   1.6 Saving your plots         │                                                                           │
     1.6.1 Exercises             │ This chapter focuses on ggplot2, one of the core packages in the          │
   1.7 Common problems           │ tidyverse. To access the datasets, help pages, and functions used in      │
   1.8 Summary                   │ this chapter, load the tidyverse by running:                              │
 Welcome! Press ? for the keys, Space e for the outline, Ctrl-p to search         ▶ terminal  term  5/38  Top 
```


tomes


``` term-screen
 R for Data Science (2e)         │ body masses of these penguins, taking into consideration the species of   │
 Welcome                         │ the penguin.                                                              │
 Preface to the second edition   │                                                                           │
 Introduction                    │        ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀                                   ┃
 Whole game                      │        ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄  ▀▀▀     ▀▀    ▀                  │
 1  Data visualization           │        ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀                │
   1.1 Introduction              │        ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▀▀▀▄                │
     1.1.1 Prerequisites         │                                              ▄▄▄                          │
   1.2 First steps               │         ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▄▄▄▀▀▄▄▄                 │
     1.2.1 The penguins data f…  │                                        ▄▄▄▀▄▀ ▀▀▄▀▀ ▀▀▀                   │
▸    1.2.2 Ultimate goal         │    ▀▀▀▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀▄▄▄▀▀▄▀▀▀▀▄▀▀▀▄▄▄▄                 │
     1.2.3 Creating a ggplot     │  ▀▀▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▄▄▄▀▀▀▀▀▀▄▄▄▄▄▀▀▀                 │
     1.2.4 Adding aesthetics a…  │ ▄▀▀▀    ▄▄▄ ▄▄▄▄ ▄▄▄▄▄▄ ▄▄ ▄▄▄▄ ▄▄ ▀▀▄ ▄▀▀▀▀▀▀▄▄▄▄▄▄▄ ▄▄▄  ▀▀▀▀▀▀▀▀       │
     1.2.5 Exercises             │ ▄▀▀▄    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▄▄▄▄▄▀▀▄▄▀▀▀▀▀▀  ▄▄▄▄▄▄▄▄       │
   1.3 ggplot2 calls             │  ▀▀▀▀▀▀▀    ▄     ▀▀  ▀▀▀  ▄▄▄  ▄▄▀▀▀▀▀▄▄▄▄▄▀▄▄▄            ▀▀▀▀▀▀▀▀▀     │
   1.4 Visualizing distributio…  │ ▀▀▄▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▄▄▀▀▀▀▀▄▀▀▀▀▄▄▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀   ▀▀▀▀▀▀▀▀▀▀▀   │
     1.4.1 A categorical varia…  │ ▀▀▀▀                 ▄▄▄▀▀▄▄▀▀▀▀▄▄▄▄▄▄▀▄▄▄▀▀▄               ▄▄▄▄▄▄▄▄▄▄▄   │
     1.4.2 A numerical variable  │ ▀▄▄        ▀ ▀▀▀▀ ▀▀▀▄▀▀▀▄▀▀▄▄▄▄▀▄▀▀▀▀▄▄ ▀▄▄  ▀  ▀             ▄▀▀▀▀▀     │
     1.4.3 Exercises             │ ▄▄▄          ▄▄▀▀▀▄▀▄▀▄▄▄▀▄▄▀▄▄▄▄▄▄▄▄▄▄                    ▄▄▄▄ ▄ ▄▄      │
   1.5 Visualizing relationshi…  │    ▀▀▀▀▀▄▄▀▀▀▀▄▄▄▀▀▄▀▀▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                 │
     1.5.1 A numerical and a c…  │    ▄▄▄▄▄ ▀▀▄▄▄▀▀▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                                        │
     1.5.2 Two categorical var…  │         ▄▄▄▀▀▀▀▄▄▄▄▄▄▄▄▀▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                 │
     1.5.3 Two numerical varia…  │         ▀▀▀▄▄▄▄▄▀  ▄▄▄▄▄▄▄▄▀       ▀ ▀    ▀       ▀ ▀  ▀▀                 │
     1.5.4 Three or more varia…  │    ▀▀▀▀▀ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄                 │
     1.5.5 Exercises             │    ▄▄▄▄▀▀▀▄▄▄▄▀▀▀▀▄▄▄▄▀▀▀▄▄▄▄▀▀▀▀▄▄▄▄▀▀▀▄▄▄▄▀▀▀▀▄▄▄▄▀▀▀▄▄                 │
   1.6 Saving your plots         │        ▄▄▄▄   ▄▄▄▄    ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▄▄▄▄   ▄▄▄▄▄                  │
     1.6.1 Exercises             │                        ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄                                │
   1.7 Common problems           │                                                                           │
   1.8 Summary                   │ 1.2.3 Creating a ggplot                                                   │
 Welcome! Press ? for the keys, Space e for the outline, Ctrl-p to search         ▶ terminal  term  5/38  12% 
```


Diagrams with big shapes survive this well; plots with thin lines and small text don't. To see them as they are, use a terminal with one of the protocols, or press `Enter` and then `o`.
