Skip to main content

Multi-Series Plots and Canvas Navigation

VisiData's canvas sheet supports overlaying multiple data series in a single graph using g. — one layer per column, toggled with number keys 1–9. This lesson teaches multi-series overlay, layer control, and full canvas navigation.

Learning Focus

The key difference: . plots one column (y-axis) against the key column (x-axis). g. plots every numeric column as a separate layer simultaneously. Use 1–9 to toggle individual layers on/off.

Sample Data Used in This Lesson​

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

cat > ~/github/practice-folder/visidata/09-metrics/server-metrics.csv << 'EOF'
hour,cpu_pct,mem_pct,disk_io_mb,req_per_sec
00,12,45,2.1,320
01,8,43,1.4,180
02,7,42,1.1,120
03,6,41,0.9,90
04,9,43,1.2,140
05,15,46,1.8,280
06,28,52,3.4,620
07,45,61,5.2,1100
08,72,74,8.9,2400
09,85,82,11.2,3200
10,88,84,12.1,3500
11,91,87,13.4,3800
12,89,86,12.8,3650
13,87,85,12.2,3400
14,90,88,13.1,3750
15,88,86,12.9,3600
16,82,81,11.8,3200
17,76,78,10.4,2800
18,65,70,8.1,2100
19,52,63,6.2,1600
20,38,56,4.8,1100
21,28,51,3.3,720
22,22,48,2.8,480
23,16,46,2.2,380
EOF

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

Step 1 — Prepare the Data​

# Cast hour to int (x-axis)
# Move to 'hour' column
#

# Cast all metric columns to float
# Move to 'cpu_pct' → %
# Move to 'mem_pct' → %
# Move to 'disk_io_mb' → %
# Move to 'req_per_sec' → %

# Set 'hour' as key column (x-axis)
# Move to 'hour' column
!

Step 2 — Single-Series Plot (.)​

Plot one metric first to understand the canvas:

# Move to 'cpu_pct' column
.

Canvas — CPU usage curve over 24 hours:

cpu_pct
│
100│ ·····
90│ ··· ·
80│ · ·
70│ · ·
60│ ·
50│ ·
40│ ·
30│ · ·
20│ · · ·
10│· · ··
0│
└────────────────────────────
0 3 6 9 12 15 18 21 23
hour

Press q to return to the source sheet.


Step 3 — Multi-Series Overlay (g.)​

Plot ALL numeric columns as separate overlaid layers:

g.

All 4 metric columns (cpu_pct, mem_pct, disk_io_mb, req_per_sec) are now plotted simultaneously, each in a different color. The canvas shows the relationship between all metrics across the day.


Step 4 — Toggle Individual Layers​

Inside the canvas, use number keys to toggle layers on/off:

1 toggle layer 1 (cpu_pct)
2 toggle layer 2 (mem_pct)
3 toggle layer 3 (disk_io_mb)
4 toggle layer 4 (req_per_sec)

Workflow — isolate two metrics for comparison:

# Press 3 → hide disk_io_mb
# Press 4 → hide req_per_sec
# Now only CPU and memory curves are visible — easier to compare

Toggle back:

# Press 3 again → re-show disk_io_mb
# Press 4 again → re-show req_per_sec

Step 5 — Canvas Navigation​

KeyAction
h j k lPan left / down / up / right
+Zoom in (both axes)
-Zoom out (both axes)
_Zoom to fit all data on screen
z_Zoom to fit vertically only
xSet x-axis range (prompt: start, end)
ySet y-axis range (prompt: min, max)
vToggle data labels on/off

Focus on business hours (09–17):

# Inside the canvas:
x
# Enter start: 9
# Enter end: 17
# Canvas zooms to show only hours 9 through 17

Zoom in on peak at noon:

+ # zoom in
+ # zoom in more
l # pan right to center on hour 12

Step 6 — Drill Into Data Points​

# Move the canvas cursor to a data point (use h/j/k/l)
Enter
# Opens the source rows that map to that canvas area

Example — drill into the 11am peak:

# Inside the multi-series canvas:
# Pan to hour=11 area
# Press Enter
# → source sheet filtered to that time window opens
# → you can see all raw metrics for those rows

Press q to return to the canvas.


Step 7 — Compare with Frequency Table Plot​

For a bar-chart style view of request volume by time of day:

# Return to source sheet
q

# Open frequency table on 'hour' column
Shift+F

# Move cursor to 'count' column (or re-add req_per_sec as aggregator)
# Plot as bar chart
.

This gives a bar-per-hour view, useful for capacity planning.


Full Canvas Key Reference​

KeyAction
.Plot current (y) column vs key (x) column
g.Plot all numeric columns as overlaid series
1–9Toggle individual plot layer on/off
h j k lPan canvas
+ / -Zoom in / out
_Fit all data
xSet x-axis range
ySet y-axis range
vToggle labels
sSelect source rows under canvas cursor
EnterOpen source rows for canvas area
qReturn to source sheet

Hands-On Practice​

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

# 1. Cast hour to int (#), mark as key (!)
# 2. Cast cpu_pct, mem_pct to % (float)
# 3. Press . on cpu_pct → single-series canvas
# 4. Press _ → zoom to fit; press + twice → zoom in
# 5. Press q → back to source
# 6. Press g. → multi-series overlay
# 7. Press 3, 4 → hide disk and requests; compare only CPU and memory
# 8. Press 3, 4 again → restore all layers
# 9. Press x → Enter start: 6, end: 12 → zoom to morning rush
# 10. Navigate to peak area → Enter → see source rows for that period

What's Next​