Trend Time SeriesNumerical
Line Chart
ggplot2: geom_line() · Package: ggplot2 · Variables: 1 temporal + 1-7 numerical series
WHAT IS A LINE CHART?
A line chart connects data points with straight lines to show how values change over a continuous dimension, most commonly time. It is the default chart for time-series data — answering "how has this metric changed over time?" Line charts can show multiple series on the same axes for comparison (e.g., revenue by product over months). They work best with at least 5-7 data points and an ordered x-axis. In ggplot2, use geom_line() and optionally geom_point() to mark individual data points.
BEST FOR
- · Trends over time
- · Comparing multiple series
- · Continuous data patterns
- · Forecasting context
AVOID WHEN
- · Categorical/unordered x-axis
- · Fewer than 4 data points
- · Unconnected discrete categories
R + GGPLOT2 CODE EXAMPLE
ggplot2
ggplot(economics, aes(x = date, y = unemploy)) + geom_line(color = "#ff6a00", linewidth = 0.8) + labs(title = "US Unemployment Over Time", x = "Date", y = "Unemployed (thousands)")
Run this code now
Paste the code above into RChat and see the line chart rendered instantly in your browser.
SIMILAR CHART TYPES
Area Chart geom_area()
Line chart with filled area beneath, emphasizing volume and magnitude of change over time.Candlestick Chart geom_candlestick()
Shows open, high, low, close prices per time period for financial instruments.Stacked Area Chart geom_area(position = "stack")
Multiple area series stacked to show how components contribute to a total over time.Slope Chart geom_segment() + geom_point() + geom_text()
Shows change between exactly two time points or conditions per category.ALTERNATIVES FOR YOUR DATA TYPE
Bar Chart Comparison, Ranking
Compares values across discrete categories using rectangular bars proportional to values.Horizontal Bar Chart Comparison, Ranking
Horizontal bars ideal for long labels, many categories, or ranked/sorted data.Grouped Bar Chart Comparison
Clusters of bars comparing sub-groups within each category side by side.