Scatterplots and Histograms
VisiData renders scatterplots by plotting one numeric column against another, and histograms through the frequency table's built-in histogram column. Both run entirely in the terminal with no external libraries.
Scatterplots reveal correlation between two variables. Histograms reveal distribution shape. Learn when each is more informative than a simple frequency table.
Sample Data Used in This Lesson
mkdir -p ~/github/practice-folder/visidata/09-metrics
cat > ~/github/practice-folder/visidata/09-metrics/requests.csv << 'EOF'
method,status,response_ms,bytes_sent
GET,200,45,1234
GET,200,120,8900
POST,201,320,456
GET,404,12,98
GET,200,980,45678
POST,500,4500,102
GET,200,67,2300
DELETE,204,38,0
GET,200,1800,12000
POST,500,3200,89
EOF
vd ~/github/practice-folder/visidata/09-metrics/requests.csv
Scatterplot: Two Numeric Variables
Goal: Visualize if larger byte sizes cause longer response times.
Step 1 — Cast and key the x-axis:
# Move to 'response_ms' column
# # cast to integer
! # mark as key column (x-axis)
Step 2 — Cast the y-axis column:
# Move to 'bytes_sent' column
# # cast to integer
Step 3 — Plot:
. # dot → opens canvas sheet
Canvas result (ASCII approximation):
bytes_sent vs response_ms
│
50000│ ·
40000│
30000│
20000│
10000│ ·
│ ·· · ·
│ · ·
└──────────────────────────────
0 500 1000 2000 5000
response_ms
Trend visible: high response_ms correlates with a 500 error (outliers top-right area).
Color-Coded by Category
When a categorical key column is set alongside a numeric key, VisiData assigns distinct colors per category:
# Move to 'method' column
! # categorical key (distinct colors per method)
# Move to 'response_ms' column
! # numeric key (x-axis)
# Move to 'bytes_sent' column
. # scatterplot: x=response_ms, each method a different color
Each HTTP method (GET, POST, DELETE) appears in a distinct color on the canvas — pattern: POST requests have longer response times (higher response_ms values).
Histogram from Frequency Table
The frequency table automatically includes a text-based histogram column using ■ characters:
# Move to 'status' column
Shift+F
Result — text histogram built-in:
status count percent histogram
200 6 60.0% ████████████████████
201 1 10.0% ███
204 1 10.0% ███
404 1 10.0% ███
500 2 20.0% ██████
This is already a histogram — readable without a canvas.
Canvas Histogram from Frequency Table
For a canvas-based (graphical) histogram:
# In the frequency table (after Shift+F on 'status'):
# Move cursor to 'count' column
. # plot count per status as a canvas histogram
Canvas shows count bars per status code visually.
Response Time Distribution
vd ~/github/practice-folder/visidata/09-metrics/requests.csv
# Cast response_ms to int
# # on 'response_ms' column
# Open frequency table to see distribution
Shift+F
Frequency table shows how response times distribute — are most requests fast (< 100ms) or slow (> 1000ms)?
Canvas Navigation Keys
| Key | Action |
|---|---|
+ / - | Zoom in / out |
_ | Zoom to fit all data |
h j k l | Pan the canvas |
s | Select source rows under canvas cursor |
Enter | Open source rows for canvas cursor area |
v | Toggle graph labels |
1–9 | Toggle individual plot layers (for multi-column overlays) |
x | Set x-axis range manually |
y | Set y-axis range manually |
Reading the Canvas
· or ⠁⠂⠄⠈ sparse data points (few in this cell)
⠿ or ⣿ dense cluster of many points
color distinct categorical values (when categorical key set)
─ │ axis lines
axis labels scale ticks
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Scatterplot shows vertical lines | X-axis column is categorical | Use a numeric column as the key |
| Canvas all one color | No categorical key set | Mark a categorical column as an additional key |
| Points too sparse to see | Data range too wide | Use x and y to set axis ranges |
| Canvas renders slowly | Very many distinct points | Filter to a sample first |
■ histogram too small to read | Terminal too narrow | Widen terminal or use canvas graph |
Hands-On Practice
vd ~/github/practice-folder/visidata/09-metrics/requests.csv
# 1. Cast response_ms to int: #
# 2. Mark response_ms as key: !
# 3. Cast bytes_sent to int: #
# 4. Press . → scatterplot of bytes_sent vs response_ms
# 5. Press + → zoom in to see the outlier points
# 6. Press Enter → see source rows for that area
# 7. Press q → back to canvas
# 8. Press q → back to source sheet
# 9. Move to 'status' column → Shift+F → view text histogram
# 10. Move cursor to 'count' column → press . → canvas histogram