pmx-canvas 0.1.26 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +191 -0
  2. package/CHANGELOG.md +110 -0
  3. package/Readme.md +74 -27
  4. package/dist/canvas/index.js +82 -82
  5. package/dist/json-render/index.css +1 -1
  6. package/dist/json-render/index.js +944 -164
  7. package/dist/types/json-render/catalog.d.ts +195 -20
  8. package/dist/types/json-render/charts/components.d.ts +17 -0
  9. package/dist/types/json-render/charts/definitions.d.ts +13 -1
  10. package/dist/types/json-render/charts/tufte-components.d.ts +65 -0
  11. package/dist/types/json-render/charts/tufte-definitions.d.ts +164 -0
  12. package/dist/types/json-render/directives.d.ts +33 -0
  13. package/dist/types/json-render/renderer/index.d.ts +1 -0
  14. package/dist/types/json-render/server.d.ts +32 -1
  15. package/dist/types/mcp/canvas-access.d.ts +62 -0
  16. package/dist/types/server/ax-state.d.ts +170 -0
  17. package/dist/types/server/canvas-db.d.ts +17 -1
  18. package/dist/types/server/canvas-operations.d.ts +53 -0
  19. package/dist/types/server/canvas-schema.d.ts +5 -1
  20. package/dist/types/server/canvas-state.d.ts +95 -4
  21. package/dist/types/server/index.d.ts +120 -3
  22. package/dist/types/server/mutation-history.d.ts +1 -1
  23. package/docs/cli.md +42 -0
  24. package/docs/http-api.md +64 -0
  25. package/docs/mcp.md +23 -5
  26. package/docs/node-types.md +1 -1
  27. package/docs/screenshots/codex-app.png +0 -0
  28. package/docs/screenshots/github-copilot-app.png +0 -0
  29. package/docs/sdk.md +23 -5
  30. package/package.json +10 -7
  31. package/skills/control-session-orchestrator/SKILL.md +359 -0
  32. package/skills/control-session-orchestrator/evals/evals.json +75 -0
  33. package/skills/data-analysis/SKILL.md +6 -0
  34. package/skills/pmx-canvas/SKILL.md +50 -4
  35. package/skills/pmx-canvas/references/github-copilot-app-adapter.md +6 -0
  36. package/skills/tufte-viz/SKILL.md +157 -0
  37. package/skills/tufte-viz/references/analytical-design.md +217 -0
  38. package/skills/tufte-viz/references/tufte-principles.md +147 -0
  39. package/src/cli/agent.ts +302 -3
  40. package/src/cli/index.ts +2 -1
  41. package/src/client/nodes/ExtAppFrame.tsx +48 -1
  42. package/src/client/nodes/McpAppNode.tsx +6 -2
  43. package/src/json-render/catalog.ts +22 -1
  44. package/src/json-render/charts/components.tsx +127 -15
  45. package/src/json-render/charts/definitions.ts +19 -2
  46. package/src/json-render/charts/extra-components.tsx +5 -4
  47. package/src/json-render/charts/tufte-components.tsx +395 -0
  48. package/src/json-render/charts/tufte-definitions.ts +128 -0
  49. package/src/json-render/directives.ts +64 -0
  50. package/src/json-render/renderer/index.css +107 -1
  51. package/src/json-render/renderer/index.tsx +33 -0
  52. package/src/json-render/server.ts +275 -5
  53. package/src/mcp/canvas-access.ts +264 -1
  54. package/src/mcp/server.ts +498 -9
  55. package/src/server/ax-context.ts +8 -3
  56. package/src/server/ax-state.ts +447 -0
  57. package/src/server/canvas-db.ts +184 -1
  58. package/src/server/canvas-operations.ts +123 -2
  59. package/src/server/canvas-schema.ts +27 -3
  60. package/src/server/canvas-state.ts +349 -2
  61. package/src/server/index.ts +259 -7
  62. package/src/server/mutation-history.ts +6 -0
  63. package/src/server/server.ts +442 -5
  64. package/src/server/web-artifacts.ts +31 -5
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: tufte-viz
3
+ description: |
4
+ Ideate and critique data visualizations using Edward Tufte's principles, and map them onto
5
+ the PMX Canvas json-render chart catalog (graph / json-render nodes). Use this skill when:
6
+ (1) Designing or critiquing a canvas graph/json-render chart
7
+ (2) Choosing a chart type, color encoding (colorBy), or primitive (Sparkline, DotPlot, BulletChart, Slopegraph)
8
+ (3) Reviewing a board's dashboards/charts for graphical integrity and data-ink
9
+ (4) Deciding between a single-series bar, small multiples, or direct labeling
10
+ (5) Reducing chartjunk or improving data-ink ratio on canvas charts
11
+ Applies: data-ink ratio, chartjunk elimination, graphical integrity, lie factor, small multiples,
12
+ data density — and the canvas colorBy decision (color must encode data, not decorate).
13
+ ---
14
+
15
+ # Tufte Visualization Ideation (PMX Canvas)
16
+
17
+ Apply Edward Tufte's principles to design clear, honest, high-density data visualizations, then
18
+ realize them with PMX Canvas `graph` / `json-render` nodes. Color must encode data, not decorate.
19
+
20
+ ## Workflow
21
+
22
+ ### For new visualizations:
23
+
24
+ 1. **Clarify the data story**
25
+ - What comparisons matter?
26
+ - What's the key insight to communicate?
27
+ - Who's the audience?
28
+
29
+ 2. **Select approach** using Tufte principles:
30
+ - High comparison need → Small multiples (several small `graph` nodes, shared scale)
31
+ - Dense data → Consider data tables (`json-render` Table), sparklines (`Sparkline`)
32
+ - Time-series → Line charts with minimal grid
33
+ - Part-to-whole → Avoid pie charts; prefer bar/table
34
+ - Ranked single metric across categories → DotPlot over a bar forest
35
+
36
+ 3. **Design with data-ink in mind**
37
+ - Start minimal, add only what's necessary
38
+ - Every element must earn its ink
39
+ - Default to a single accent; use the full palette only when color *encodes* a variable
40
+
41
+ 4. **Apply the eraser test before shipping**
42
+ - For every element (label, tick, gridline, border, annotation): can it be erased without losing
43
+ information that's not already conveyed elsewhere?
44
+ - Watch for duplicate encodings: numeric labels next to a value already marked by a tick; legends
45
+ duplicating direct labels; per-panel scale annotations duplicating a shared-scale caption.
46
+ - If two elements compete for the same job, keep the visual one and drop the textual one (or vice
47
+ versa) - not both.
48
+
49
+ 5. **Apply the collision test before shipping**
50
+ - For every text element in the plot (axis labels, point annotations, epoch labels, baseline
51
+ labels, explanatory notes): mentally draw its bounding box. Does anything else - another text
52
+ element, a data line, dense markers - live in or cross that box?
53
+ - The eraser test catches *redundant* elements; the collision test catches *crowded* ones. Both
54
+ must pass.
55
+ - Standard fixes: move explanatory prose out of the plot into a nearby markdown node; relocate
56
+ band/epoch labels to a dedicated strip above the plot; push baseline/reference labels to the
57
+ outside margin; give each in-plot annotation a leader line so the marker and the text occupy
58
+ clearly separated space.
59
+ - Watch especially: inverted axes; shared-scale small multiples (labels stacked near zero in every
60
+ panel); dense scatter (text vanishes into the dot cloud unless explicitly cleared).
61
+
62
+ 6. **Apply the Tufte test** (see references/tufte-principles.md)
63
+
64
+ ### For critiquing visualizations:
65
+
66
+ 1. **Check graphical integrity**
67
+ - Calculate lie factor if proportions seem off
68
+ - Verify baselines and scales (bar and area charts must start at zero)
69
+ - Look for 3D distortion
70
+
71
+ 2. **Identify chartjunk**
72
+ - Decorative elements
73
+ - Heavy grids
74
+ - Unnecessary 3D effects
75
+ - Moiré patterns
76
+ - Gratuitous per-category color on a single-series chart (decoration, not encoding)
77
+
78
+ 3. **Evaluate data-ink ratio**
79
+ - What can be erased?
80
+ - What's redundant?
81
+
82
+ 4. **Suggest improvements** with specific before/after recommendations
83
+
84
+ ## Mapping to the PMX Canvas chart catalog
85
+
86
+ Realize these designs with `canvas_add_graph_node` (graph nodes) and `canvas_add_json_render_node`.
87
+ The chart catalog: `LineChart`, `BarChart`, `PieChart`, `AreaChart`, `ScatterChart`, `RadarChart`,
88
+ `StackedBarChart`, `ComposedChart`, plus the Tufte primitives `Sparkline`, `DotPlot`, `BulletChart`,
89
+ and `Slopegraph`.
90
+
91
+ ### Color must encode data — the `colorBy` decision (single-series bar/column)
92
+
93
+ A single-series `BarChart` measures **one** variable across categories. Coloring each bar differently
94
+ encodes nothing — it is decoration (chartjunk). Use the `colorBy` prop:
95
+
96
+ | `colorBy` | When to use |
97
+ |-------------|-----------------------------------------------------------------------------|
98
+ | `series` (default) | One accent for all bars, one bar highlighted (Tufte-safe emphasis). Use to draw the eye to the bar that *matters* (max, target, the row under discussion). |
99
+ | `category` | Opt in only when the category itself is a nominal variable the reader must map by color (e.g. team identity reused across several charts with a shared key). |
100
+ | `value` | Sequential shade by magnitude. Note this **double-encodes** — the bar's length already encodes the value — so reserve it for when the lightness ramp genuinely aids reading a ranked magnitude; otherwise `series`/`none` are more honest. |
101
+ | `none` | Flat single accent, no highlight. Maximal data-ink for dense small multiples. |
102
+
103
+ Default to `series`. Do **not** reach for `category` to "make it colorful." Pie/radar/stacked-bar
104
+ already rotate the palette because each slice/series **is** a distinct variable — leave those as-is.
105
+
106
+ ### Tufte primitives (prefer over heavier charts)
107
+
108
+ - **`Sparkline`** — word-sized time-series, no axes/labels. Use inline in tables/dashboards and one
109
+ per row to show a trajectory at a glance. Replaces "trending up / volatile" prose with the shape.
110
+ - **`DotPlot`** — ranked single metric across categories. Replaces a forest of bars: a dot per
111
+ category on a shared axis. Far higher data-ink ratio than bars; sorts make the macro pattern pop.
112
+ - **`BulletChart`** — a measure against a target with qualitative bands. Replaces a gauge/dial
113
+ (which is chartjunk). Use for KPI-vs-target, progress-vs-goal.
114
+ - **`Slopegraph`** — two-time-point comparison across many categories (before/after). Direct slope
115
+ encodes change and rank simultaneously; labels sit at the endpoints (direct labeling, no legend).
116
+ Lines default to a single neutral ink; set `colorByDirection` to accent rising lines and mute
117
+ falling ones only when the direction is the point (and beware it editorializes — a falling
118
+ error-rate is "good", a falling revenue is "bad").
119
+
120
+ ### Direct labeling over legends
121
+
122
+ Legends force the eye to ping-pong between key and plot (a duplicate encoding). Prefer labeling the
123
+ data directly: end-of-line labels on `LineChart`/`Slopegraph`, endpoint labels on `DotPlot`, the
124
+ highlighted bar's value on `BarChart`. Set `showLegend: false` on graph nodes when one or two series
125
+ are directly identifiable; reserve legends for genuinely many overlapping series.
126
+
127
+ ### Small multiples over many overlapping series
128
+
129
+ When more than ~4 series would overlap in one chart, do **not** cram them into a single multi-color
130
+ `LineChart`. Create several small `graph` nodes with an **identical shared scale** and consistent
131
+ encoding, arranged in a grid (`canvas_arrange` grid, or a `group`). Position means the same thing in
132
+ every panel; the sequence tells the macro story while each panel carries the micro detail. This is
133
+ almost always better than color-coding 6+ lines.
134
+
135
+ ## Key Principles Reference
136
+
137
+ - `references/tufte-principles.md` - core principles from *Visual Display of Quantitative Information*:
138
+ lie factor, data-ink, chartjunk, small multiples, integrity.
139
+ - `references/analytical-design.md` - extensions from *Envisioning Information*, *Visual Explanations*,
140
+ and *Beautiful Evidence*: the 6 principles of analytical design, sparklines, layering & separation,
141
+ micro/macro, range-frames, causality, confections. Load when designing dashboards, dense displays,
142
+ sparklines, or explanatory graphics.
143
+
144
+ **Quick checklist:**
145
+ - [ ] Lie Factor ≈ 1.0 (no visual distortion; bars and areas start at zero)
146
+ - [ ] Maximum data-ink ratio
147
+ - [ ] Zero chartjunk (no per-category color unless color encodes a variable)
148
+ - [ ] `colorBy` chosen deliberately — default `series` (single accent + one highlight); avoid `value` unless the magnitude ramp earns the double-encode
149
+ - [ ] Clear labeling, direct over legend
150
+ - [ ] Answers "compared to what?"
151
+ - [ ] Shows causality or mechanism where relevant
152
+ - [ ] Multivariate (not over-reduced)
153
+ - [ ] Words, numbers, images integrated - not segregated
154
+ - [ ] Reveals multiple levels of detail (micro + macro)
155
+ - [ ] Layering: primary data dominates, secondary recedes
156
+ - [ ] Appropriate data density — Sparkline/DotPlot considered before a heavier chart
157
+ - [ ] >4 overlapping series → small multiples, not one rainbow chart
@@ -0,0 +1,217 @@
1
+ # Analytical Design Principles
2
+
3
+ Extended principles from *Envisioning Information*, *Visual Explanations*, and *Beautiful Evidence*.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Six Principles of Analytical Design](#six-principles-of-analytical-design)
8
+ 2. [Sparklines](#sparklines)
9
+ 3. [Layering and Separation](#layering-and-separation)
10
+ 4. [Micro/Macro Readings](#micromacro-readings)
11
+ 5. [Range-Frames and Related Techniques](#range-frames-and-related-techniques)
12
+ 6. [Showing Causality](#showing-causality)
13
+ 7. [Confections](#confections)
14
+
15
+ ---
16
+
17
+ ## Six Principles of Analytical Design
18
+
19
+ These govern the design of any serious analytical presentation - charts, maps, diagrams, or evidence displays.
20
+
21
+ ### 1. Show Comparisons, Contrasts, Differences
22
+
23
+ - The fundamental analytical question is always "compared to what?"
24
+ - Every display should make at least one comparison explicit
25
+ - Side-by-side placement is stronger than sequential placement
26
+ - Differences should be shown directly rather than requiring mental arithmetic
27
+
28
+ ### 2. Show Causality, Mechanism, Explanation, Systematic Structure
29
+
30
+ - Go beyond "what happened" to "why it happened"
31
+ - Show the causal mechanism, not just the correlation
32
+ - Use arrows, annotations, or sequencing to indicate direction of effect
33
+ - Integrate explanatory text with the data display
34
+
35
+ ### 3. Show Multivariate Data (More Than 1 or 2 Variables)
36
+
37
+ - The real world is multivariate; flatten it at your peril
38
+ - Use small multiples, color channels, size, position, and faceting to encode multiple dimensions simultaneously
39
+ - Avoid over-reducing: a single average line hides the story in the distribution
40
+
41
+ ### 4. Completely Integrate Words, Numbers, and Images
42
+
43
+ - The best analytical displays weave text, data, and graphics into a single coherent view
44
+ - Don't segregate "the chart" from "the explanation" - put them together
45
+ - Labels, annotations, and data should coexist in the same visual space
46
+ - Source notes and methodology belong with the graphic, not in a footnote pages away
47
+
48
+ ### 5. Thoroughly Describe the Evidence
49
+
50
+ - Provide a title that names the data, the measurement, and the context
51
+ - Label axes with units, time range, and source
52
+ - Document what data is excluded or transformed
53
+ - Quality, relevance, and integrity of evidence should be self-evident
54
+
55
+ ### 6. Content Counts Most of All
56
+
57
+ - Analytical presentations stand or fall on the quality and relevance of the content
58
+ - No amount of design skill can rescue poor or irrelevant data
59
+ - Choose the question carefully; then design the graphic to answer it with maximum clarity
60
+
61
+ ---
62
+
63
+ ## Sparklines
64
+
65
+ Intense, simple, word-sized graphics that can be embedded in text, tables, or dashboards.
66
+
67
+ ### Characteristics
68
+
69
+ - Typically the height of a text line (~20-30px at screen resolution)
70
+ - No axes, no labels, no grids
71
+ - Data pattern speaks entirely through shape
72
+ - Usually time-series: left is past, right is present
73
+ - Can show reference bands (normal range), endpoints, min/max dots
74
+
75
+ ### Design Guidelines
76
+
77
+ - Keep aspect ratio approximately banking to 45 degrees (the average slope of the data should be ~45 degrees for optimal perception)
78
+ - Use a small red/colored dot for the most recent value or the min/max
79
+ - Embed in context: "Revenue grew steadily [sparkline] before the Q3 dip"
80
+ - For tables: one sparkline per row provides pattern recognition across many entities at a glance
81
+
82
+ ### When to Use
83
+
84
+ - Dashboards where space is precious
85
+ - Inline with narrative text to show trends without interrupting reading flow
86
+ - Tables of KPIs where each row benefits from a visual trajectory
87
+ - Anywhere you'd otherwise write "trending up" or "volatile" - show it instead
88
+
89
+ ---
90
+
91
+ ## Layering and Separation
92
+
93
+ Techniques for organizing complex displays so that different types of information are visually stratified.
94
+
95
+ ### The Problem
96
+
97
+ When many data elements, labels, grids, and annotations share a single plane, the result is visual confusion - everything competes for attention equally.
98
+
99
+ ### Solutions
100
+
101
+ 1. **Color layering** - Primary data in high-contrast (black/dark); secondary reference data in low-contrast (light gray); structural elements (axes) in between
102
+ 2. **Weight layering** - Data lines thicker than grid lines; grid lines thinner than axis lines
103
+ 3. **Transparency/opacity** - Background elements at 20-40% opacity; foreground data at 100%
104
+ 4. **Spatial separation** - Use whitespace to group related elements and separate unrelated ones
105
+ 5. **The 1+1=3 effect** - Two adjacent dark elements create a perceived third element (the white gap between them). Be aware of this and control it
106
+
107
+ ### Practical Rules
108
+
109
+ - Grid: lightest layer (if present at all)
110
+ - Axes and frame: medium layer
111
+ - Data: heaviest layer (darkest ink, thickest stroke)
112
+ - Annotations: medium-dark, but positioned to avoid collision with data
113
+ - Background: minimal or none (white/very light)
114
+
115
+ ---
116
+
117
+ ## Micro/Macro Readings
118
+
119
+ Displays that simultaneously serve two levels of reading: the overall pattern (macro) and the individual data point (micro).
120
+
121
+ ### The Idea
122
+
123
+ A well-designed high-resolution display rewards both:
124
+ - A quick glance (macro): What's the overall shape, trend, or story?
125
+ - Close inspection (micro): What are the individual values? Which points are outliers?
126
+
127
+ ### How to Achieve
128
+
129
+ 1. **High data density** - Show all the data, not just aggregates
130
+ 2. **Clear ordering** - Sort/arrange so the macro pattern emerges from the micro data
131
+ 3. **Progressive revelation** - Overall pattern visible at arm's length; detail visible up close
132
+ 4. **Direct labeling** - Selected important data points labeled directly, others readable by position
133
+
134
+ ### Examples in Practice
135
+
136
+ - A map where individual data points form a visible geographic pattern
137
+ - A scatter plot where the cloud shape tells the correlation story, but individual labeled outliers are identifiable
138
+ - Small multiples where each panel is a micro view but the sequence tells a macro story
139
+
140
+ ---
141
+
142
+ ## Range-Frames and Related Techniques
143
+
144
+ Alternatives to the conventional box axes that use less ink while conveying more information.
145
+
146
+ ### Range-Frame
147
+
148
+ Instead of drawing axes from arbitrary round numbers to round numbers, the axis line spans only the range of the data (from min to max). This encodes additional information (the data range) into an element that was previously just structural.
149
+
150
+ ### Dot-Dash Plot
151
+
152
+ Instead of tick marks at round intervals, place a tick mark at each actual data value along the axis. The distribution of ticks immediately shows data density and gaps.
153
+
154
+ ### Quarter-Frame
155
+
156
+ Only two sides of the frame are drawn (typically left and bottom), and only as far as the data extends.
157
+
158
+ ### When to Use
159
+
160
+ - Range-frames: almost always preferable to standard full-frame axes
161
+ - Dot-dash: when showing distribution along an axis matters (scatter plots, strip plots)
162
+ - Quarter-frame: when data doesn't approach all four edges of the plot area
163
+
164
+ ---
165
+
166
+ ## Showing Causality
167
+
168
+ Techniques for moving beyond correlation to communicate mechanism and cause-effect relationships.
169
+
170
+ ### Principles
171
+
172
+ 1. **Temporal sequence** - Cause precedes effect; arrange displays chronologically when causality is temporal
173
+ 2. **Mechanism diagrams** - Show the pathway from cause to effect, not just the endpoints
174
+ 3. **Counterfactual comparison** - Show what happened alongside what would have happened without the intervention
175
+ 4. **Confound acknowledgment** - Note or visualize potential confounders rather than ignoring them
176
+
177
+ ### Visual Techniques
178
+
179
+ - Before/after with a clear intervention marker
180
+ - Parallel time-series: treatment vs. control
181
+ - Flow diagrams showing causal chains
182
+ - Annotations on inflection points explaining what changed
183
+
184
+ ### Honesty Requirements
185
+
186
+ - Don't imply causation when you only have correlation
187
+ - Show uncertainty bands where appropriate
188
+ - If the causal mechanism is debated, note it
189
+ - Show the data that argues against your interpretation alongside the data that supports it
190
+
191
+ ---
192
+
193
+ ## Confections
194
+
195
+ Assemblages of many visual elements that together provide a richly informative, often explanatory, display.
196
+
197
+ ### What They Are
198
+
199
+ Confections combine multiple modes of information:
200
+ - Diagrams + data + annotations + comparisons in a single integrated display
201
+ - Often narrative: they tell a story with a beginning, middle, and end
202
+ - May mix scales, perspectives, or time periods in a single view
203
+
204
+ ### When to Use
205
+
206
+ - Explaining complex systems or processes
207
+ - Teaching: where understanding mechanism matters more than precision
208
+ - Summarizing research findings with their context
209
+ - Executive briefings that need to convey both "what" and "why"
210
+
211
+ ### Design Principles
212
+
213
+ 1. **Unity** - Despite multiple elements, the display should read as one coherent piece
214
+ 2. **Hierarchy** - The most important information is most prominent
215
+ 3. **Flow** - The reader's eye should move through the display in a logical sequence
216
+ 4. **Density** - Every region of the display should carry information; no dead zones
217
+ 5. **Integration** - Words and images work together; neither is redundant to the other
@@ -0,0 +1,147 @@
1
+ # Core Tufte Principles
2
+
3
+ Reference for the fundamental principles from *The Visual Display of Quantitative Information*.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Graphical Integrity](#graphical-integrity)
8
+ 2. [Data-Ink Ratio](#data-ink-ratio)
9
+ 3. [Chartjunk](#chartjunk)
10
+ 4. [Small Multiples](#small-multiples)
11
+ 5. [Data Density](#data-density)
12
+ 6. [The Tufte Test](#the-tufte-test)
13
+
14
+ ---
15
+
16
+ ## Graphical Integrity
17
+
18
+ The representation of numbers on a graphic should be directly proportional to the numerical quantities represented.
19
+
20
+ ### Lie Factor
21
+
22
+ ```
23
+ Lie Factor = (size of effect shown in graphic) / (size of effect in data)
24
+ ```
25
+
26
+ - A lie factor of 1.0 means perfect honesty
27
+ - Lie factors > 1.05 or < 0.95 distort perception
28
+ - Common sources of distortion:
29
+ - Truncated baselines (bar charts not starting at zero)
30
+ - Area/volume encoding where length would suffice
31
+ - 3D perspective making nearer elements appear larger
32
+ - Non-linear axis scaling without clear labeling
33
+
34
+ ### Principles of Graphical Integrity
35
+
36
+ 1. Show data variation, not design variation
37
+ 2. Use clear, detailed, thorough labeling to defeat distortion
38
+ 3. In time-series displays, standardize monetary units (deflate for inflation)
39
+ 4. The number of information-carrying dimensions should not exceed the number of dimensions in the data
40
+ 5. Context: show the data in context - "compared to what?"
41
+
42
+ ---
43
+
44
+ ## Data-Ink Ratio
45
+
46
+ The share of a graphic's ink devoted to non-redundant display of data-information.
47
+
48
+ ```
49
+ Data-Ink Ratio = (data-ink) / (total ink used in graphic)
50
+ ```
51
+
52
+ ### Maximizing Data-Ink
53
+
54
+ Within reason, the goal is to maximize the data-ink ratio:
55
+
56
+ 1. **Erase non-data-ink** - Remove elements that don't convey data (decorative borders, background fills, heavy axis boxes)
57
+ 2. **Erase redundant data-ink** - If the same information is encoded twice (e.g., both a label and a position), remove one
58
+ 3. **Revise and edit** - Iterate toward the simplest possible representation that retains all data meaning
59
+
60
+ ### Practical Applications
61
+
62
+ - Replace heavy gridlines with light ones, or remove entirely if direct labels suffice
63
+ - Use range-frame axes (axes that span only the data range, not arbitrary round numbers)
64
+ - Remove chart borders/boxes
65
+ - Use white gridlines on a light gray background (Tufte's "sparkline" aesthetic)
66
+ - Let data points serve as their own tick marks where possible
67
+
68
+ ---
69
+
70
+ ## Chartjunk
71
+
72
+ Non-data elements or redundant data elements that clutter a visualization without adding information.
73
+
74
+ ### Three Varieties
75
+
76
+ 1. **Unintentional optical art** - Moiré patterns from hatching, vibrating fills, and tight parallel lines that create visual interference
77
+ 2. **The grid** - Heavy, prominent grids that compete with or dominate the data
78
+ 3. **The duck** - Elaborate decorative structures built around the data (3D effects, pictorial embellishments, ornamental frames)
79
+
80
+ ### How to Eliminate
81
+
82
+ - Default to no background fill, no border, no grid
83
+ - Add gridlines only if the reader needs to extract precise values - and make them light/receding
84
+ - Never use 3D unless the data is inherently three-dimensional
85
+ - Remove legends when direct labeling is feasible
86
+ - Remove decorative icons, clip art, or illustrations layered onto the data area
87
+
88
+ ---
89
+
90
+ ## Small Multiples
91
+
92
+ A series of similar graphs or charts using the same scale and axes, allowing easy comparison across a varying condition.
93
+
94
+ ### When to Use
95
+
96
+ - Comparing the same measure across many categories (regions, time periods, groups)
97
+ - Showing change over time for multiple entities
98
+ - Exploring multivariate data by faceting on one dimension
99
+ - Whenever you're tempted to use color-coding to distinguish many overlapping series
100
+
101
+ ### Design Principles
102
+
103
+ 1. **Shared scales** - All panels must use identical axis ranges so position means the same thing everywhere
104
+ 2. **Consistent structure** - Same layout, same visual encoding in each panel
105
+ 3. **Minimal per-panel decoration** - Axis labels, ticks, and titles appear once (shared) rather than repeated in each panel
106
+ 4. **Clear ordering** - Arrange panels in a meaningful order (alphabetical, by outcome magnitude, by geography)
107
+ 5. **Reference elements** - Include a common reference (e.g., overall average) as a light/gray line in each panel for context
108
+
109
+ ### Density
110
+
111
+ Small multiples can be packed tightly. Each panel should be large enough to reveal the data pattern but small enough that the eye can compare across many panels in a single view.
112
+
113
+ ---
114
+
115
+ ## Data Density
116
+
117
+ The amount of data shown per unit area in a graphic.
118
+
119
+ ```
120
+ Data Density = (number of entries in data matrix) / (area of data graphic)
121
+ ```
122
+
123
+ ### High-Density Displays
124
+
125
+ - Most published graphics have far lower data density than they could achieve
126
+ - Sparklines: intense, simple, word-sized graphics embedded in text or tables
127
+ - Data tables with integrated graphical elements can achieve very high density
128
+ - The human eye can resolve very fine differences - don't underestimate the reader
129
+
130
+ ### Shrink Principle
131
+
132
+ Graphics can be shrunk far more than we usually think. A well-designed graphic retains meaning at small sizes because the data pattern (not the labels or decoration) carries the story.
133
+
134
+ ---
135
+
136
+ ## The Tufte Test
137
+
138
+ A synthesis checklist for evaluating any completed visualization:
139
+
140
+ 1. **Is the lie factor close to 1.0?** - No distortions in area, length, or position
141
+ 2. **Is the data-ink ratio high?** - Could anything be erased without information loss?
142
+ 3. **Is there zero chartjunk?** - No decoration, no moiré, no unnecessary 3D
143
+ 4. **Does it answer "compared to what?"** - Context, baseline, or reference is present
144
+ 5. **Is labeling clear and integrated?** - Labels sit close to the data they describe, not in a distant legend
145
+ 6. **Is the data density appropriate?** - For the story being told, is enough data shown? Could a table or sparkline show more?
146
+ 7. **Would small multiples work better?** - If more than ~4 series overlap, consider faceting
147
+ 8. **Does every element earn its ink?** - One final pass: point to each mark and ask what it communicates