Skip to main content

Graphs and Plots

VisiData renders graphs directly in your terminal using Unicode Braille characters — no GUI, no matplotlib, no external tools required. Graphs are interactive: you can zoom, pan, and drill into data points.

Prerequisites

Before graphing, ensure your columns are cast to the correct type# for integers, % for floats. A column typed as str will produce a blank canvas or a single vertical line. See Column Types and Casting if needed.

Learning Focus

Learn the two-step graph setup: mark key column (x-axis or category) → move to numeric columnpress . (dot). Then use canvas navigation to zoom and explore.


Sample Data Used in This Lesson

mkdir -p ~/github/practice-folder/visidata/09-metrics

cat > ~/github/practice-folder/visidata/09-metrics/system_metrics.csv << 'EOF'
timestamp,cpu_pct,mem_pct,load_avg
2025-01-15 00:00,12.5,45.2,0.8
2025-01-15 00:05,15.3,46.1,0.9
2025-01-15 00:10,18.7,47.8,1.2
2025-01-15 00:15,89.2,72.3,4.5
2025-01-15 00:20,45.6,65.1,2.8
2025-01-15 00:25,21.3,51.4,1.3
2025-01-15 00:30,14.8,48.9,0.9
EOF

vd ~/github/practice-folder/visidata/09-metrics/system_metrics.csv

Plot CPU Over Time

Step 1 — Cast and key the timestamp column:

# Move to 'timestamp' column
@ # cast to date type
! # mark as key column (x-axis)

Step 2 — Cast the numeric column:

# Move to 'cpu_pct' column
% # cast to float

Step 3 — Plot:

. # dot → open canvas sheet

Canvas output (ASCII approximation):

cpu_pct vs timestamp

90│ ·
80│
70│
60│
50│ ·
40│
30│
20│ · · · · · ·
10│
└──────────────────────────
00:00 00:10 00:20 00:30

The spike at 00:15 is immediately visible.


Plot All Numeric Columns (g.)

# From source sheet with timestamp as key:
g.
# Plots cpu_pct, mem_pct, and load_avg all overlaid on one canvas
# Each column gets a distinct color

Use 1, 2, 3 to toggle individual layers on/off to isolate signals.


Drill Into a Spike

# Inside the canvas, zoom into the 00:15 spike:
+ # zoom in (centered on cursor)

# Navigate to the spike area with hjkl

# Press Enter to open the source rows in that visible area
Enter
# Sheet opens: only rows from 00:10–00:20

Press q to return to the canvas.


Plot from a Frequency Table (Histogram)

vd ~/github/practice-folder/visidata/01-loading/01-employees.csv

# Move to 'role' column
Shift+F # open frequency table

# Inside frequency table, move to 'count' column
. # canvas graph of counts per role

Result — bar-like distribution of role counts.


Canvas Navigation Keys

KeyAction
+ / -Zoom in / out
_Zoom to fit all data
h j k lPan the canvas
sSelect source rows under canvas cursor
EnterOpen source rows for canvas cursor area
gEnterOpen all visible source rows
vToggle graph labels
19Toggle individual plot layers
xSet x-axis range manually
ySet y-axis range manually

Axis Control

# Set x-axis range
x
# Enter: 0 100 (xmin xmax)

# Set y-axis range
y
# Enter: 0 100 (ymin ymax)

# Reset to auto-fit
_

Terminal Requirements

export TERM=xterm-256color
export LANG=en_US.UTF-8
# Wide terminal: 80+ columns, 40+ rows recommended

Troubleshooting

ProblemCauseFix
Graph is emptyNo key column setPress ! on x-axis column first
Braille blocks look garbledTerminal doesn't support UTF-8export LANG=en_US.UTF-8
All points in one lineColumn type is stringCast numeric column to # or %
Graph too dense to readToo many data pointsFilter rows first, then plot
Colors missingTerminal not 256-colorexport TERM=xterm-256color

Hands-On Practice

vd ~/github/practice-folder/visidata/09-metrics/system_metrics.csv

# 1. Move to 'timestamp' column → press @ (date) → press ! (key)
# 2. Move to 'cpu_pct' column → press % (float)
# 3. Press . → canvas opens with CPU plot
# 4. Press + → zoom into the spike
# 5. Press _ → zoom out to fit all
# 6. Press Enter → see source rows in visible area
# 7. Press q → back to canvas
# 8. Press q → back to sheet
# 9. Press g. → plot ALL numeric columns overlaid

What's Next