Creating Data Visualizations (Line Charts, Bar Graphs, Tables)
Back to Academy
20Practice·Core

Creating Data Visualizations (Line Charts, Bar Graphs, Tables)

Design honest, publication-grade figures that survive grayscale printing and reviewer suspicion.

7 min read Practice June 9, 2026

Full Guide

Executive Summary

A figure is an argument compressed into pixels — and it is often the only part of your evaluation a triaging reviewer truly reads. A great figure makes your result land in two seconds; a bad one invites suspicion, and a misleading one (even accidentally) gets you accused of the cardinal sin: dishonesty. Practitioners arrive fluent in dashboard eye-candy and have to unlearn it: publication figures are spare, grayscale-safe, uncertainty-aware, and reproducible from code.

This module teaches principled visualization for security: matching chart type to claim, encoding uncertainty, surviving grayscale printing and colorblind readers, avoiding the classic chart deceptions, and generating every figure from source so it reproduces.

The one-line mental model: A figure is a claim. It must be instantly readable, honest about uncertainty, and regenerable from code — or it weakens the very result it depicts.

Learning Outcomes

By the end of this module you will be able to:

  • Match chart type to data and claim.
  • Design grayscale-safe, colorblind-safe figures.
  • Avoid the dozen classic chart deceptions.
  • Build reproducible figures from code (matplotlib/ggplot).

1. Match the Chart to the Claim

The chart type is a claim about your data's structure. Picking the wrong one forces the reader to fight the figure.

diagram — rendering…
flowchart TD
    Q["What is the claim?"] --> A["Compare categories<br/>(evasion % per EDR)"]
    Q --> B["Trend over a continuum<br/>(detection vs. payload size)"]
    Q --> C["Distribution / spread<br/>(time-to-detect)"]
    Q --> D["Part-to-whole<br/>(rarely useful)"]
    A --> A1["Bar chart<br/>(with error bars)"]
    B --> B1["Line chart"]
    C --> C1["Box / violin / ECDF"]
    D --> D1["Stacked bar > pie"]

    style A1 fill:#0c2a22,stroke:#10e793,color:#d1fae5
    style C1 fill:#0c1f2a,stroke:#08d9d6,color:#cffafe
    style D1 fill:#2a0c14,stroke:#ef233c,color:#fee2e2
Claim shapeRight chartWrong chart (common error)
Evasion % across 9 EDRsBar with CIsLine (implies false continuity)
Detection vs. payload sizeLineBar (hides the trend)
Spread of time-to-detectBox/violin/ECDFBar of means (hides variance)
Proportion of alert typesStacked bar / tablePie (hard to compare slices)

The recurring mistake is the bar-of-means that hides variance: it shows your average time-to-detect but conceals that one product was instant and another never detected. A box plot or ECDF shows the distribution, which is usually the real story.


2. Always Encode Uncertainty

A point without an interval is a lie of omission. Every estimate you plot — every bar, every line point — should carry its uncertainty from Module 19.

text
✗ DISHONEST (bare means)        ✓ HONEST (means + 95% CI)   evasion %                       evasion %   100│   █                        100│   ┬    75│   █   █                      75│   █   ┬    50│   █   █   █                  50│   █   █   ┬    25│   █   █   █                  25│   █   █   █      └───────────                     └─┴───┴───┴──        A   B   C                        A   B   C   (looks decisive)                 (B and C overlap →                                     difference may be noise)

The error bars change the conclusion: bars A, B, C that look like a clean ranking may have overlapping intervals, meaning the ranking is within noise. A reviewer who sees error bars trusts you; one who sees bare bars wonders what you're hiding. State in the caption exactly what the bars represent (95% CI? SD? SEM? — they are not interchangeable).


3. Grayscale- and Colorblind-Safe Design

Your paper may be printed in black and white, and ~8% of male readers have color-vision deficiency. A figure that relies on red-vs-green to carry meaning fails both audiences — including, ironically, security's favorite palette.

diagram — rendering…
flowchart LR
    DATA["Series to distinguish"] --> R["Redundant encoding"]
    R --> C1["Color (CVD-safe palette:<br/>e.g., Okabe-Ito)"]
    R --> C2["+ Shape / marker"]
    R --> C3["+ Line style (solid/dash/dot)"]
    R --> C4["+ Direct labels (no legend hunt)"]

    style R fill:#0c2a22,stroke:#10e793,color:#d1fae5

The rule is redundant encoding: never let color be the only thing distinguishing two series. Pair it with marker shape, line style, or — best of all — direct labels on the lines so the reader never consults a legend. Test the figure by printing it grayscale and by running it through a colorblindness simulator; if series become indistinguishable, redesign before submission.


4. The Classic Deceptions (and How to Not Commit Them)

Reviewers are primed to spot chart manipulation, and committing one even accidentally taints the whole paper's credibility. Know the canon.

DeceptionWhat it doesHonest practice
Truncated y-axisExaggerates small differencesStart bars at 0 (line charts may differ — note it)
Dual y-axesImplies spurious correlationAvoid; use two panels
Cherry-picked rangeHides inconvenient dataShow full range; mark exclusions
3-D / area effectsDistorts magnitudeUse flat 2-D
Unequal binsMisshapes distributionsEqual bins; show counts
No sample sizeImplies false precisionAnnotate n on the figure
text
TRUNCATED-AXIS DECEPTION   ✗ y from 70-80%          ✓ y from 0-100%   80│  █                   100│   78│  █  █                 75│  █  █  █   76│  █  █  █              50│  █  █  █   74│  █  █  █              25│  █  █  █   72│  █  █  █               0└──────────     └─────────                  A  B  C   "huge gaps!"              "actually nearly equal"

The truncated y-axis is the most common accidental deception in practitioner figures — a 2-point difference rendered as a towering gap. Start bar charts at zero unless you have a stated, defensible reason, and annotate n directly on the figure so precision isn't oversold.


5. Reproducible Figures from Code

A figure made by hand in a GUI cannot be regenerated, audited, or fixed when the data updates. Generate every figure from a script that reads your released dataset — so the figure, like the result, is reproducible (Module 14).

diagram — rendering…
flowchart LR
    DS["Released dataset<br/>(v1.0, Mod 17)"] --> SCRIPT["plot.py / plot.R<br/>(in the repo)"]
    SCRIPT --> FIG["figure.pdf (vector)"]
    SCRIPT --> NUM["the same numbers<br/>cited in text"]
    FIG --> PAPER["Paper"]
    NUM --> PAPER

    style SCRIPT fill:#0c2a22,stroke:#10e793,color:#d1fae5
    style PAPER fill:#1a230c,stroke:#fca311,color:#fef3c7

Three practices: emit vector formats (PDF/SVG) so figures stay crisp at any zoom and in print; have the same script produce both the figure and the in-text numbers (so they can never disagree); and commit the plotting code as part of your artifact. "Figure 4 is generated by make figures from dataset v1.0" is a sentence that an Artifact Evaluation committee loves and a fabricator cannot honestly write.


Step-by-Step Practical Exercise

Goal: Produce one publication-grade, uncertainty-encoded, grayscale-safe figure from your dataset, generated entirely from a committed script.

Time: ~75 minutes. You need: your labeled dataset (Module 17), your computed CIs (Module 19), and matplotlib or ggplot.

Step 1 — Match chart to claim (10 min). State your headline claim in one sentence, then pick the chart type from §1. Justify why the alternatives mislead.

Step 2 — Plot with uncertainty (20 min). Write a script that reads the dataset and renders the chart with 95% CI error bars (§2). Annotate n on the figure and name the interval type in the caption.

Step 3 — Make it CVD/grayscale-safe (15 min). Apply redundant encoding (§3): CVD-safe palette + markers/line styles + direct labels. Export grayscale and confirm series stay distinguishable.

Step 4 — Audit for deceptions (15 min). Run your figure against the §4 table. Fix any truncated axis, missing n, or 3-D effect. Confirm bars start at zero (or justify otherwise in the caption).

Step 5 — Make it reproducible (15 min). Ensure the script outputs vector (PDF/SVG) and that any number you quote in text comes from the same script. Commit it as figures/plot.py with a one-line make target.

Deliverable: one vector figure with error bars, CVD/grayscale-safe encoding, on-figure n, no deceptions, plus the committed script that regenerates it. This figure and its script go straight into your paper and artifact.


Where to go next

Related reading on the blog: "The Truncated Axis That Got Me a Major Revision" and "Make Your Figures Survive a Grayscale Printer".