Description
The line graph connects ordered data points with line segments, creating a continuous visual path that the eye naturally follows. It is the default choice for showing how a quantitative value changes over a continuous dimension, most commonly time. The slope of the line between two points immediately communicates rate of change, while the overall shape reveals trends, cycles, and anomalies.
Line graphs exploit the Gestalt principle of continuity: viewers perceive the connected points as a single entity moving through space, making it easy to track a series and mentally extrapolate its trajectory. Multiple lines on the same axes enable direct comparison of trends across groups, though legibility degrades beyond 5-7 overlapping series.
The x-axis typically represents the continuous or ordinal dimension (time, sequence), while the y-axis represents the measured quantity. Unlike bar charts, the y-axis of a line graph does not strictly need to start at zero if the emphasis is on relative change rather than absolute magnitude, though this should be done carefully to avoid misleading viewers.
Prompt Examples
Try these prompts with Claude, ChatGPT, or other AI tools:
“2020년부터 2024년까지 월별 사용자 수 추이를 선 그래프로 그려주세요.”
“Create a multi-line chart showing temperature trends for 3 cities over the past decade.”
“Plot monthly revenue as a line chart with a trend line and confidence interval shading.”
When to Use
- Showing trends, patterns, or trajectories over time (stock prices, temperature, metrics)
- Comparing how multiple series evolve over the same time period
- Highlighting rates of change, acceleration, or inflection points
- Displaying continuous data where interpolation between points is meaningful
When NOT to Use
- Comparing values across unrelated categories — use a bar chart
- When the x-axis categories have no meaningful order — connecting unordered points implies false continuity
- Showing distributions of a single variable — use a histogram or box plot
- When you have very few data points (2-3) — a bar chart may communicate the comparison more clearly
Anatomy
- Line mark: The connected path through data points, encoding the trend.
- Data points (dots): Optional markers at each observation. Useful when data is sparse; often hidden for dense series.
- X-axis: The continuous or ordinal dimension (usually time).
- Y-axis: The quantitative measure.
- Legend: Required when multiple series share the chart. Direct labeling at line endpoints is often clearer than a separate legend.
- Grid lines: Horizontal grid lines help readers estimate values; vertical grid lines are less common.
- Annotations: Callouts for peaks, troughs, or notable events add context.
Variations
- Multi-series line graph: Multiple lines on the same axes for group comparison.
- Step line chart: Uses horizontal and vertical segments instead of diagonal lines, appropriate when values hold constant between changes (e.g., pricing tiers, discrete state changes).
- Sparkline: A small, word-sized line graph stripped of axes and labels, embedded inline in text or tables.
- Slope chart (slopegraph): A line graph with only two time points, focusing on the change between a start and end state.
- Bump chart: A line graph where the y-axis shows rank rather than value, tracking how rankings shift over time.
Code Reference
// Observable Plot - multi-series line graph
Plot.plot({
marks: [
Plot.lineY(data, {
x: "date",
y: "value",
stroke: "series",
tip: true
}),
Plot.ruleY([0])
],
x: { type: "time", label: "Date" },
y: { label: "Value" },
color: { legend: true }
})